I've created a cpp and header file called staff. Staff inputs closing and opening hours of a train station. While User can read them.
Code below is Staff writing to a txt file.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18
void Staff::SelangorOperationHours()
{
ofstream outputFile;
outputFile.open("SelangorOperationHours.txt"); //TODO 24 hour clock so user does not type 123131 am
string SelangorOpening, SelangorClosing;
cout << "Enter Opening Hours for Selangor Station: ";
cin >> SelangorOpening;
outputFile << SelangorOpening << endl;
cout << "Enter Closing Hours for Selangor Station: ";
cin >> SelangorClosing;
outputFile << SelangorClosing << endl;
outputFile.close();
cout << "Done!\n";
}
Now I would like that user to be able to read know the opening and closing hours, this section is causing me some problems.
Code below reference is from http://www.cplusplus.com/forum/general/55650/
That's weird the problem is that the .txt file was empty. I could have sworn that I previously wrote something in the txt file.
Well, thanks for helping out.