-1
hi everyone im new to c++ (im in my second semester) and i have a question about some errors im getting. I am using the vi editor and i am getting the following two errors:
assign2.cpp:39: error: âDATAFILEâ was not declared in this scope
assign2.cpp:40: error: âOUTFILEâ was not declared in this scope
here is my code:
#include <iostream>
#include <iomanip>
#include <fstream>
using namespace std;
const int NAMESIZE=11;
const int FILENAMESIZE=51;
typedef char NAME_t[NAMESIZE];
typedef int GRADE_t;
typedef char FILENAME_t[FILENAMESIZE];
typedef fstream DATAFILE_t;
typedef fstream OUTFILE_t;
class cStudent
{
private:
NAME_t fname;
NAME_t lname;
GRADE_t t1;
GRADE_t t2;
GRADE_t t3;
GRADE_t t4;
GRADE_t assigngrade;
GRADE_t examgrade;
public:
cStudent();
};//end class
void READ(DATAFILE_t &DATAFILE);
void PRINT(OUTFILE_t &OUTFILE);
void Finalize(DATAFILE_t &DATAFILE, OUTFILE_t &OUTFILE);
main()
{
cStudent tempstudent;
cStudent::cStudent();
READ(DATAFILE);
PRINT(OUTFILE);
Finalize(DATAFILE,OUTFILE);
}//end main
void READ(DATAFILE_t &DATAFILE)
{
FILENAME_t inputfile;
cout<<"Enter the name of the data file:"<<endl;
cin>>inputfile;
DATAFILE.open(inputfile,ios::in);
};
void PRINT(OUTFILE_t &OUTFILE)
{
FILENAME_t outputfile;
cout<<"Enter the name of the output file to be created:"<<endl;
cin>>outputfile;
OUTFILE.open(outputfile,ios::out);
};
void Finalize(DATAFILE_t &DATAFILE, OUTFILE_t &OUTFILE)
{
cout<<"Now closing input and output files...."<<endl;
DATAFILE.close();
OUTFILE.close();
cout<<"Terminating program.....GOODBYE..."<<endl;
};
can anyone help me because I am very much stuck
thanks!!!
atticusr5
Junior Poster
129 posts since Jan 2010
Reputation Points: 10
Solved Threads: 0
Skill Endorsements: 0