hi there ,my program is not considiring with anything that relates to the heder file
fstream i dont know why although iv called the header fstream
these are the arrors:
Error 3 error C2065: 'inData' : undeclared identifier
Error 5 error C2228: left of '.fail' must have class/struct/union
Error 4 error C2228: left of '.open' must have class/struct/union
Error 6 error C2440: '=' : cannot convert from 'std::string' to 'char' line86
Error 7 error C2440: '=' : cannot convert from 'std::string' to 'char'line 87
Error 1 error C3646: 'ifstream' : unknown override specifier
Error 2 error C3646: 'inData' : unknown override specifier
can any one figur out what is the problem ??
this is the prog<its not complet yet^___^>
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94
|
# include <iostream>
# include <fstream>
# include <string>
using namespace std;
//declaring global arrays
int SID[50];//to store ID
string Fname[50];//to store the firsit name
string Major[50];
float GPA[50];
int HRS[50];
//declare function prototype
void RedaData();
//precondition:open the files that have the data
//the size of the array is fixed
//postcondition:save all data into the apropreiat array
void DisplayMenu();
//it will give the user some options to select
//precondition:the option selected must be in the rang
//or give apropriate error massage
//postecondition:depending on the choice of the function call
//that function
void FindStud();
//precondition:get the student id from the user
//serch for the id in the array
//postcondition:display the stud info on tghe screen
void AddStud();
//precoondition:the stud id must cheeack if it eixist befor adding
//stud info
//get the info from the user
//postconditon:add the info to each of the five array
void DeletStud();
//precondition:ask the user for the id that is wanted to be deleted
//postcondition:serch 4 the id
//set the studID to 0 and the actual data is the same
//but during printing the summary we will use the zero
void StopPrint();
//precondition:deleted recordes where the id is set to 0 will not be
//printed or saved.
//postcondition:print the final report of the student in the screen and the output file
void searchData(int[])
//precondition:get the id nuumber
//serch the id in the array
//postcondition:return abool valu true if the id eixist.
ifstream inData;
int main()
{
RedaData();
return 0;
}
void RedaData()
{
//declaring function scoop variabels
int ID,TH;
string Fname,Major;
float GPAstud;
//open the file inData
inData.open("stydInput.txt");
if(inData.fail())
{
cout<< "cannot open the file"<<endl;
return ;}
//red the first line from the file
inData>>ID>>Fname>>Major>>GPAstud>>TH;
//inilizeing loob condition were we will read the info and send them to the arrays
//its just amatrix serch how do we red form the file if it was like this
//if i remember we will use 2 loops
//one 2 control the raw and 1 the column:)
while(inData)
{
for(int x=0;x<=5;x++)
{
SID[x]=ID;
Fname[x]=Fname;
Major[x]=Major;
GPA[x]=GPAstud;
HRS[x]=TH;
inData>>ID>>Fname>>Major>>GPAstud>>TH;
}
cout<<ID<<'\t'<<Fname<<'\t'<<Major<<'\t'<<GPAstud<<'\t'<<TH<<endl;
}
}//end of void function
|
p.s im using parallel arrays
thanks alot