R
Rhodrey
I have the following code:
#include <iostream>
#include <fstream>
#include <string>
#include <iomanip>
#include <cstdlib>
#include <conio.h>
#include "stdinfo.h"
using namespace std;
//void checkStatus( fstream& );
//int checkGrades( int, int, int, int );
int main()
{
fstream outStudentFile( "data.txt", ios::in | ios:
ut );
if ( !outStudentFile ) {
cerr << "File could not be opened for output. " << endl;
exit( 1 );
}
cout << "Please enter the following information in the file. "
<< "Use -1 to end input. " << endl << endl;
studentdata student;
cout << "Please enter ID Number (Enter -1 to end input): ";
cin >> student.idnumber;
while ( ( student.idnumber ) != -1 ) {
cout << "Enter First and Last Names: ";
cin >> student.firstName >> student.lastName;
cout << "Enter Status (I or A): ";
cin >> student.status;
checkStatus ( outStudentFile );
cout << "Enter 4 Grades: " ;
cin >> student.grade >> student.grade1 >> student.grade2
outStudentFile << student.idnumber << " " << student.firstName << "
" << student.lastName
<< " " << student.status << " " << student.grade << " " <<
student.grade1
<< " " << student.grade2 << " " << student.grade3 << '\n';
cout << "\nPlease enter ID Number (Enter -1 to end input): ";
cin >> student.idnumber;
}
outStudentFile.clear();
outStudentFile.close();
return 0;
}
Do you have any idea why I'm getting the following error when
compiling?
Compiling...
sfile.cpp
C:\Documents and Settings\Rhodrey Shaw\My Documents\Data
Structures\sfile.cpp(9) : error C2143: syntax error : missing ';'
before 'using'
Error executing cl.exe.
sfile.obj - 1 error(s), 0 warning(s)
#include <iostream>
#include <fstream>
#include <string>
#include <iomanip>
#include <cstdlib>
#include <conio.h>
#include "stdinfo.h"
using namespace std;
//void checkStatus( fstream& );
//int checkGrades( int, int, int, int );
int main()
{
fstream outStudentFile( "data.txt", ios::in | ios:
if ( !outStudentFile ) {
cerr << "File could not be opened for output. " << endl;
exit( 1 );
}
cout << "Please enter the following information in the file. "
<< "Use -1 to end input. " << endl << endl;
studentdata student;
cout << "Please enter ID Number (Enter -1 to end input): ";
cin >> student.idnumber;
while ( ( student.idnumber ) != -1 ) {
cout << "Enter First and Last Names: ";
cin >> student.firstName >> student.lastName;
cout << "Enter Status (I or A): ";
cin >> student.status;
checkStatus ( outStudentFile );
cout << "Enter 4 Grades: " ;
cin >> student.grade >> student.grade1 >> student.grade2
outStudentFile << student.idnumber << " " << student.firstName << "
" << student.lastName
<< " " << student.status << " " << student.grade << " " <<
student.grade1
<< " " << student.grade2 << " " << student.grade3 << '\n';
cout << "\nPlease enter ID Number (Enter -1 to end input): ";
cin >> student.idnumber;
}
outStudentFile.clear();
outStudentFile.close();
return 0;
}
Do you have any idea why I'm getting the following error when
compiling?
Compiling...
sfile.cpp
C:\Documents and Settings\Rhodrey Shaw\My Documents\Data
Structures\sfile.cpp(9) : error C2143: syntax error : missing ';'
before 'using'
Error executing cl.exe.
sfile.obj - 1 error(s), 0 warning(s)