Example #1
0
int main() {
    int menuInt=0;
    CommunicationNetwork network;

    while (menuInt !=5) {
        menuInt = menu();

        switch (menuInt) {
        case 1:
            //cout<<"Building network"<<endl;
            network.buildNetwork();
            //cout<<"Network built"<<endl;
            break;
        case 2:
            //cout<<"Printing network path"<<endl;
            network.printNetwork();
            break;
        case 3:
            //cout<<"Transmitting message"<<endl;
            network.transmitMsg("messageIn.txt");
            break;
        case 4:
            //cout<<"Adding city"<<endl;
            getCityIn(&network);
            break;
        default:
            cout<<"Goodbye!"<<endl;
            break;
        }
    }
    return 0;
}
Example #2
0
int main()
{

    string x;
    CommunicationNetwork cn;


    while (x != 9)
    {
    cout << "======Main Menu======" << endl;
    cout << "1. Build Network" << endl;
    cout << "2. Print Network Path" << endl;
    cout << "3. Transmit Message Coast-To-Coast" << endl;
    cout << "4. Add City" << endl;
    cout << "5. Delete City" << endl;
    cout << "6. Count Total Cities" << endl;
    cout << "7. Count number of cities between two cities" << endl;
    cout << "8. Show path between cities" << endl;
    cout << "9. Quit" << endl;
        cin>>x;
        string city1;
        string city2;
        string message;
            if(x == "1"){
                cn.buildNetwork();
                cn.printNetwork();
                }
            else if(x == "2"){
                cn.printNetwork();
            }
            else if(x == "3"){
                cout<<"Type a message"<<endl;
                cin>>message;
                cn.transmitMsg(message);
                cout<<"type a return message"<<endl;
                cin>>message;
                cn.transmitmessback(message);
                }


            else if( x == "4"){