Tolulekes,
On line 56
myfile.open ("Aisosa.txt", ios::in|ios::ate);
opens for input when it needs to be for output. Also before line 56 or on line 56 you need to define myfile as an
ofstream
otherwise you will have problem. You should also check to make sure the file is open.
In checkSeats() line 66 would work better as
getline(cin, something);
this way you can type a first name space last name. cin will just read until the first white space so, you only get the first name. For some reason I also had to add the code
1 2
|
cin.clear();
cin.ignore(CIN_MAX_LIMIT, '\n');
| |
To make the getline() work. I defined
CIN_MAX_LIMIT
as being 32700 something or just put some large number in that place.
Line 70 your while is reading an entire line from the file. Yet in the if statement you are trying to compare an entire line of data to a small portion and that will never work. I added the variable
lname
to pick up the last name then added the line
name = name + “ “ + lname;
so that name would contain first and last name. At the end of the function I added:
1 2
|
Sleep(5000); // to wait 5 seconds to read what was output
Myfile.close();
| |
dhayden mentioned to initialize the variable on line 97. Then in the case statements set choice to zero before the break.
Hope that helps,
Andy