//I'm having trouble figuring out how to open the file "chartIn.txt" in my menu under option one. I am able to get the menu to display but when I press "option 1" nothing happens.
Can anyone tell me how to fix this?
cout << "Please enter your choice: ";
cin >> choice;
cout << "----------------------------" << endl;
switch (choice)
{
case 1:
displaySeatChart();
break;
case 2:
reserveSeat();
break;
case 3:
cancelReservation();
break;
case 4:
saveSeatChartToFile();
break;
case 5:
statisticsOption();
break;
case 6:
helpOption();
break;
default:
quitOption();
}
} while (choice != 6);
return 0;
}
void readChart()
{
int rowNumber;
char seat1, seat2, seat3, seat4;
Note.. Please use code tags to display codes in the future.
Here's what I used as the text, "chartIn.txt", to be read in.
First the row number, followed by 'A' for an Adult in the seat, or 'C' for a Child. Not sure what you were using, as you didn't say, or hint at it.
Thanks for your response. Sorry about my code, it was my first time posting and I wasn't sure how to do the correct format.
Notes:
*I am on a mac using Xcode (apparently Xcode has many problems with the fstream library?)
*My text file is a basic airplane seating chart. 1-10 are rows and letters A-D symbolize the seats in the rows.
1 A B C D
2 A B C D
3 A B C D
4 A B C D
5 A B C D
6 A B C D
7 A B C D
8 A B C D
9 A B C D
10 A B C D
When I compiled my code, nothing at all came up when I called the function to display the seating chart.
Although, when I ran yours something did come up but not the text file that I displayed above...
All it returned was:
row 0:
row 1:
row 2:
row 3:
row 4:
row 5:
row 6:
row 7:
row 8:
row 9:
I'm wondering if you or anyone else has any idea as to why this is happening? By the way I've tried all the suggestions for changing the settings in Xcode, the file location and everything else I could find and still none of this works.
Sorry, I won't be much help, as I am not on a Mac, so don't know how to overcome these problems. Hopefully, someone more versed in this OS will lend a hand.