I've posted the same question on this forum before. However, I failed to reply early to a user that attempted to help out and I think the question has been lost in the forums amongst all the other questions.
http://www.cplusplus.com/forum/general/235349/
So with the help of the guys here I've managed to create a vector that stores information into a txt file.
The system function as stated below, Staff can
1) Add station (no limitation to how many can be added, station info consists of 4 strings and 1 int that have to be added)
2) View Stations (simply read the station txt file above)
3) Edit stations
The issue I'm currently facing is editing the stations. I would like to do so through the command prompt, I am not sure how exactly this will be accomplished. If the user simply drags the mouse over to the information he would like edited and starts removing/adding information that would be ideal.
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
|
void Staff::ManageSelangorRailway()
{
int select;
cout << "Please select one of the following options: \n\n";
cout << "1) Add Station 2) Edit/Delete Station 3) View Station 4) Return";
cin >> select;
switch (select)
{
case 1:
{
vector <StationInfo> getStationInfo;
ofstream out("SelangorStations.txt", ofstream::out | ofstream::app);
char accept = 'y';
char reject = 'n';
while (tolower(accept) == 'y')
{
StationInfo stationInfo = GetStationInfo();
getStationInfo.push_back(stationInfo);
cout << endl;
out << stationInfo;
cout << "Would you like to add another station ? (y/n): ";
if (cin >> accept)
{
out.close();
Staff::Staff();
}
else if (cin >> reject)
{
Staff();
}
}
break;
}
case 2:
{
}
| |
I have searched quite a few resources and attempted to edit the code in order to make it work with mine, does not seem to be working though.
Not sure if I should fill up the question up with my failed attempts. If any of you want them I'll share.
At this point would anyone mind, writing out the code. I'm burnt out and would love nothing more then to understand it by actually looking at the code.