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
|
#include <iostream>
#include <string>
#include <vector>
using namespace std;
const int TOTALSTOP = 11;
const vector <string> dBusstop= { "SIPCOT", "Adyar", "Parrys Corner",
"CIA Station", "Kumaran", "Kelambakken", "Taramani",
"FBI Staion", "Post Office", "Lattice", "TCS" };
const int dMinutes[TOTALSTOP] [TOTALSTOP ] =
{{0, 4, 0, 0, 0, 0, 0, 0, 0, 0, 0}, // SIPCOT = 0
{4, 0, 4, 0, 0, 0, 4, 0, 0, 0, 5}, // Adyar= 1
{0, 4, 0, 2, 0, 0, 0, 0, 0, 0, 0}, // Parrys Corner = 2
{0, 0, 2, 0, 4, 0, 0, 0, 0, 0, 0}, // CIA Station = 3
{0, 0, 0, 4, 0, 3, 0, 0, 0, 0, 0}, // Kumara = 4
{0, 0, 0, 0, 3, 0, 0, 0, 0, 0, 0}, // Kelambakken = 5
{0, 4, 0, 0, 0, 0, 0, 3, 0, 0, 3}, // Taramani = 6
{0, 0, 0, 0, 0, 0, 3, 0, 0, 5, 0}, // FBI Staion = 7
{0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, // Post Office = 8
{0, 0, 0, 0, 0, 0, 0, 5, 0, 0, 3}, // Lattice = 9
{0, 5, 0, 0, 0, 0, 3, 0, 0, 3, 0}}; // TCS= 10
struct Road {
vector <string> stop;
int roadNumber;
};
void newRoad();
bool roadReadData(Road & road);
vector <Road*> dRoads; // pointer for roads
int main () {
newRoad();
return 0;
}
void newRoad(){
Road* newRoad = new Road;
cout << "\n New Road: \n";
roadReadData(*newRoad);
dRoads.push_back(newRoad);
cout << "\n new road has been added with numer " << dRoads.size() << '\n';
}
bool roadReadData(Road & road) {
//here needs to:
// ask the user to chose road number
// print out all available staions in the vector
// ask the user to chose stations for the chosen road, need to chose numbers
// as same as the number of staions in vector
// when he chose 0, her must be stop then print out the stations which entered
// any duplicated station will be error
}
|