Help!!! w/error C2065: 'LettGrad' : undeclared identifier

fitzm

Senior member
Mar 17, 2000
691
0
0
Total newbie to programming. I can't figure out why this error is claiming LettGrade is undeclared. I have it declared. Help please!
Heres the program:

#include <iostream.h>
#include <fstream.h

void main()
{


float score = (float)0.0; converted to a float.
char LettGrade = ' '; variable.

ifstream inFile;

inFile.open(&quot;a:/stuScr.dat&quot;,ios::in);
if(!inFile.fail())
{

outFile.open(&quot;a:/LettGrad.out&quot;,ios::eek:ut);


if(!outFile.fail())//This tests if the outFile did not fail to open.

{
inFile >> score;

while(!inFile.eof())
{
if(score>= 89.5)
LettGrad='A';
else
if(score>=79.5)
LettGrad='B';
else
if(score>=69.5)
LettGrad='C';
else
if(score>=59.5)
LettGrad='D';
else
LettGrad='F';



outFile << LettGrad << endl;
inFile >> score;

}//end while

//close outFile and inFile
outFile.close();
inFile.close();

cout<<&quot;Program Completed&quot;<<endl;

}
else

cout<<&quot;Error opening output file&quot;<<endl;

} else
cout<<&quot;Error opening input file&quot;<<endl;

}//End of main function





 

Argo

Lifer
Apr 8, 2000
10,045
0
0
Well, cuz you declare it as LettGrade and use it as LetGrad

You know, it helps to proof read before asking questions ;)
 

fitzm

Senior member
Mar 17, 2000
691
0
0
Gracias Argo. Actually the variable name is LettGrad. Two t's. I caaught it early this morning. You know it's so easy to miss the little stuff. Your right though, syntax errors are the easy bugs to find.