Jump to content

  • Log In with Google      Sign In   
  • Create Account

#ActualTrickJay

Posted 03 May 2013 - 12:59 PM

#include <iostream>
#include <iomanip>
#include <fstream>
#include <string>

using namespace std;
struct highscore{
int svar;
};

struct game{
int fraga;
int val;
};


int main(){
    ofstream game;
    ofstream highscore;
    bool fail = true;
    int lost, fraga[10], svar = 0; // these are for the Start option
    int load ,loadh, loadg, tillbaka; // these are for the loading option
    string line, line2; // also loading option
    char val;

    game.open("game.txt", ios::app);
    if (!game){
        cout << "file could not open";
        exit (1);
    }

    do{
        cout << " Menu" << endl;
        cout << " 1. Start" << endl;
        cout << " 2. Load" << endl;
        cout << " 3. Credits" << endl;
        cin >> val;
        switch(val){

              case '1':

                      highscore.open("Highscore.txt", ios::app);
                      if (!highscore){
                      cout << "file could not open";
                      exit (1);
                      }
                         cout << "WELCOME TO THE CISCO QUIZ  GOOD LUCK" << endl;
                         cout << "how many layers are there in the OSI model?" << endl;
                         cout << "1. 4" << endl;
                         cout << "2. 5" << endl;
                         cout << "3. 7" << endl;
                         cin >> fraga;
                         switch(fraga){
                                      case 1:

                                           cout << "Game Over!" << endl;
                                           cout << "Do you wish to restart? (answer with 1 for yes and 2 for no)" << endl;
                                           cin >> lost;
                                           if(lost == 2 ){
                                                   fail = false;
                                                   }
                                           break;

                                      case 2:

                                           cout << "Game Over!" << endl;
                                           cout << "Do you wish to restart? (answer with 1 for yes, 2 for no)" << endl;
                                           cin >> lost;
                                           if(lost == 2 ){
                                                   fail = false;
                                                   }
                                           break;

                                      case 3:
                                           svar = svar + 5;
                                           break;
                                      default:
                                        cout << "error" << endl;
                                           }

                                           if(svar == 5){
                                              cout << "what is the full name of OSPF?" << endl;
                                              cout << "1. Open Shortest Path First" << endl;
                                              cout << "2. Online Shooting Pro Fishing" << endl;
                                              cout << "3. On Short Path First" << endl;
                                              cin >> fraga;
                                              switch(fraga){

                                                              case 1:
                                                              svar = svar + 5;
                                                                   break;

                                                              case 2:
                                                                   cout << "Game Over!"<< endl;
                                                                   cout << "Do you wish to restart? (answer with 1 for yes, 2 for no)" << endl;
                                                                   cin >> lost;
                                                                   if(lost == 2 ){
                                                                      fail = false;
                                                                      }
                                                                   break;


                                                              case 3:
                                                                   cout << "Game Over!" << endl;
                                                                   cout << "Do you wish to restart? (answer with 1 for yes, 2 for no)" << endl;
                                                                   cin >> lost;
                                                                   if(lost == 2 ){
                                                                      fail = false;
                                                                     }
                                                                     }
                                                                     }
                         if(svar == 10){
                         cout << "What does TTL mean?" << endl;
                         cout << "1. Twin Twitched Life" << endl;
                         cout << "2. Two Time Lives" << endl;
                         cout << "3. Time To Live" << endl;
                         cin >> fraga;
                           switch(fraga){
                             case 1:
                              cout << "Game Over!" << endl;
                              cout << "Do you wish to restart? (answer with yes, YES or Yes)"<< endl;
                              cin >> lost;
                                      if(lost == 2 ){
                                         fail = false;
                                           }
                             break;


                           case 2:
                             cout << "Game Over!" << endl;
                             cout << "Do you wish to restart? (answer with 1 for yes and 2 for no)" << endl;
                             cin >> lost;
                                if(lost == 2 ){
                                     fail = false;
                                         }
                           break;


                           case 3:
                           svar = svar + 10;
                           break;
                           }
                           }
                          if(svar == 20){
                                  cout << "What is the first command you enter on a Cisco router?" << endl;
                                  cout << " 1. enable"<< endl;
                                  cout << " 2. disable" << endl;
                                  cout << " 3. enter" << endl;
                                  cin >> fraga;

                                  switch(fraga){
                                                case 1:
                                                     svar = svar + 5;
                                                     break;

                                                case 2:
                                                     cout << "Game Over!" << endl;
                                                     cout << "Do you wish to restart? (answer with 1 for yes and 2 for no)" << endl;
                                                     cin >> lost;
                                                      if(lost == 2 ){
                                                           fail = false;
                                                                   }
                                                     break;
                                                case 3:
                                                     cout << "Game Over!" << endl;
                                                     cout << "Do you wish to restart? (answer with 1 for yes and 2 for no)" << endl;
                                                     cin >> lost;
                                                      if(lost == 2 ){
                                                         fail = false;
                                                                    }
                                                     break;
                                                     }
                                                     }
                                                                                          if(svar == 25){
                                              cout << "which protocol is the most prefered?" << endl;
                                              cout << " 1. RIP" << endl;
                                              cout << " 2. EGRP" << endl;
                                              cout << " 3. EIGRP" << endl;
                                              cin >> fraga;
                                              switch(fraga){
                                                            case 1:
                                                                   cout << "Game Over!" << endl;
                                                                   cout << "Do you wish to restart? (answer with 1 for yes and 2 for no)" << endl;
                                                                   cin >> lost;
                                                                       if(lost == 2 ){
                                                                           fail = false;
                                                                                     }
                                                                   break;


                                                             case 2:
                                                                  cout << "Game Over!"<< endl;
                                                                  cout << "Do you wish to restart? (answer with 1 for yes and 2 for no)" << endl;
                                                                  cin >> lost;
                                                                   if(lost == 2 ){
                                                                        fail = false;
                                                                                 }
                                                                    break;


                                                            case 3:
                                                                 svar = svar + 15;
                                                                 cout << "You have completed the game press 1 to exit or if you wish to do it again or check highscores press 2" << endl;
                                                                 cin >> lost;
                                                                 if (lost != 1 ){
                                                                          fail = false;
                                                                          }
                                                                 break;
                                                            }
                                                        }
                                                  highscore <<"Score: " << svar << '\n';
                                              highscore.close();
                                              game << fraga << val;
                                              game.close();
                                              cin.ignore(10,'\n');

                                              cin.get();

         case '2':
            cout << "type 1 to load game or type 2 to load highscores" << endl;
            cin >> load;
            if (load == 1){
                     ifstream loadg ("game.txt");
                 if (loadg.is_open())
                 {
                  while ( loadg.good() )
                  {
                   getline (loadg,line2);
                           cout << line2 << endl;
                       }
                       cout << "do you wish to return to the menu press 1 else press any number" << endl;
                       cin >> tillbaka;
                       if (tillbaka != 1){
                                    fail = false;
                                    }
                                    game.close();
                             } 
                 }
            else if(load == 2){
                 ifstream loadh ("highscore.txt");
                 if (loadh.is_open())
                 {
                  while ( loadh.good() )
                  {
                   getline (loadh,line);
                           cout << line << endl;
                       }
                       cout << "do you wish to return to the menu press 1 else press any number" << endl;
                       cin >> tillbaka;
                       if (tillbaka != 1){
                                    fail = false;
                                    }

                    highscore.close();

                                   }
                 }
                 cin.ignore(10,'\n');

    cin.get();
            break;




 

}
}while(fail);

}

so here's the code open to all suggestions ohmy.png

 

NOTE: have also tried to save the game.txt as a .dat didnt help much tho :S




 


#3TrickJay

Posted 03 May 2013 - 12:38 PM

#include <iostream>
#include <iomanip>
#include <fstream>
#include <string>

using namespace std;
struct highscore{
int svar;
};

struct game{
int fraga;
int val;
};


int main(){
    ofstream game;
    ofstream highscore;
    bool fail = true;
    int lost, fraga[10], svar = 0; // these are for the Start option
    int load ,loadh, loadg, tillbaka; // these are for the loading option
    string line, line2; // also loading option
    char val;

    game.open("game.txt", ios::app);
    if (!game){
        cout << "file could not open";
        exit (1);
    }

    do{
        cout << " Menu" << endl;
        cout << " 1. Start" << endl;
        cout << " 2. Load" << endl;
        cout << " 3. Credits" << endl;
        cin >> val;
        switch(val){

              case '1':

                      highscore.open("Highscore.txt", ios::app);
                      if (!highscore){
                      cout << "file could not open";
                      exit (1);
                      }
                         cout << "WELCOME TO THE CISCO QUIZ  GOOD LUCK" << endl;
                         cout << "how many layers are there in the OSI model?" << endl;
                         cout << "1. 4" << endl;
                         cout << "2. 5" << endl;
                         cout << "3. 7" << endl;
                         cin >> fraga;
                         switch(fraga){
                                      case 1:

                                           cout << "Game Over!" << endl;
                                           cout << "Do you wish to restart? (answer with 1 for yes and 2 for no)" << endl;
                                           cin >> lost;
                                           if(lost == 2 ){
                                                   fail = false;
                                                   }
                                           break;

                                      case 2:

                                           cout << "Game Over!" << endl;
                                           cout << "Do you wish to restart? (answer with 1 for yes, 2 for no)" << endl;
                                           cin >> lost;
                                           if(lost == 2 ){
                                                   fail = false;
                                                   }
                                           break;

                                      case 3:
                                           svar = svar + 5;
                                           break;
                                      default:
                                        cout << "error" << endl;
                                           }

                                           if(svar == 5){
                                              cout << "what is the full name of OSPF?" << endl;
                                              cout << "1. Open Shortest Path First" << endl;
                                              cout << "2. Online Shooting Pro Fishing" << endl;
                                              cout << "3. On Short Path First" << endl;
                                              cin >> fraga;
                                              switch(fraga){

                                                              case 1:
                                                              svar = svar + 5;
                                                                   break;

                                                              case 2:
                                                                   cout << "Game Over!"<< endl;
                                                                   cout << "Do you wish to restart? (answer with 1 for yes, 2 for no)" << endl;
                                                                   cin >> lost;
                                                                   if(lost == 2 ){
                                                                      fail = false;
                                                                      }
                                                                   break;


                                                              case 3:
                                                                   cout << "Game Over!" << endl;
                                                                   cout << "Do you wish to restart? (answer with 1 for yes, 2 for no)" << endl;
                                                                   cin >> lost;
                                                                   if(lost == 2 ){
                                                                      fail = false;
                                                                     }
                                                                     }
                                                                     }
                         if(svar == 10){
                         cout << "What does TTL mean?" << endl;
                         cout << "1. Twin Twitched Life" << endl;
                         cout << "2. Two Time Lives" << endl;
                         cout << "3. Time To Live" << endl;
                         cin >> fraga;
                           switch(fraga){
                             case 1:
                              cout << "Game Over!" << endl;
                              cout << "Do you wish to restart? (answer with yes, YES or Yes)"<< endl;
                              cin >> lost;
                                      if(lost == 2 ){
                                         fail = false;
                                           }
                             break;


                           case 2:
                             cout << "Game Over!" << endl;
                             cout << "Do you wish to restart? (answer with 1 for yes and 2 for no)" << endl;
                             cin >> lost;
                                if(lost == 2 ){
                                     fail = false;
                                         }
                           break;


                           case 3:
                           svar = svar + 10;
                           break;
                           }
                           }
                          if(svar == 20){
                                  cout << "What is the first command you enter on a Cisco router?" << endl;
                                  cout << " 1. enable"<< endl;
                                  cout << " 2. disable" << endl;
                                  cout << " 3. enter" << endl;
                                  cin >> fraga;

                                  switch(fraga){
                                                case 1:
                                                     svar = svar + 5;
                                                     break;

                                                case 2:
                                                     cout << "Game Over!" << endl;
                                                     cout << "Do you wish to restart? (answer with 1 for yes and 2 for no)" << endl;
                                                     cin >> lost;
                                                      if(lost == 2 ){
                                                           fail = false;
                                                                   }
                                                     break;
                                                case 3:
                                                     cout << "Game Over!" << endl;
                                                     cout << "Do you wish to restart? (answer with 1 for yes and 2 for no)" << endl;
                                                     cin >> lost;
                                                      if(lost == 2 ){
                                                         fail = false;
                                                                    }
                                                     break;
                                                     }
                                                     }
                                                                                          if(svar == 25){
                                              cout << "which protocol is the most prefered?" << endl;
                                              cout << " 1. RIP" << endl;
                                              cout << " 2. EGRP" << endl;
                                              cout << " 3. EIGRP" << endl;
                                              cin >> fraga;
                                              switch(fraga){
                                                            case 1:
                                                                   cout << "Game Over!" << endl;
                                                                   cout << "Do you wish to restart? (answer with 1 for yes and 2 for no)" << endl;
                                                                   cin >> lost;
                                                                       if(lost == 2 ){
                                                                           fail = false;
                                                                                     }
                                                                   break;


                                                             case 2:
                                                                  cout << "Game Over!"<< endl;
                                                                  cout << "Do you wish to restart? (answer with 1 for yes and 2 for no)" << endl;
                                                                  cin >> lost;
                                                                   if(lost == 2 ){
                                                                        fail = false;
                                                                                 }
                                                                    break;


                                                            case 3:
                                                                 svar = svar + 15;
                                                                 cout << "You have completed the game press 1 to exit or if you wish to do it again or check highscores press 2" << endl;
                                                                 cin >> lost;
                                                                 if (lost != 1 ){
                                                                          fail = false;
                                                                          }
                                                                 break;
                                                            }
                                                        }
                                                  highscore <<"Score: " << svar << '\n';
                                              highscore.close();
                                              game << fraga << val;
                                              game.close();
                                              cin.ignore(10,'\n');

                                              cin.get();

         case '2':
            cout << "type 1 to load game or type 2 to load highscores" << endl;
            cin >> load;
            if (load == 1){
                     ifstream loadg ("game.txt");
                 if (loadg.is_open())
                 {
                  while ( loadg.good() )
                  {
                   getline (loadg,line2);
                           cout << line2 << endl;
                       }
                       cout << "do you wish to return to the menu press 1 else press any number" << endl;
                       cin >> tillbaka;
                       if (tillbaka != 1){
                                    fail = false;
                                    }
                                    game.close();
                             } 
                 }
            else if(load == 2){
                 ifstream loadh ("highscore.txt");
                 if (loadh.is_open())
                 {
                  while ( loadh.good() )
                  {
                   getline (loadh,line);
                           cout << line << endl;
                       }
                       cout << "do you wish to return to the menu press 1 else press any number" << endl;
                       cin >> tillbaka;
                       if (tillbaka != 1){
                                    fail = false;
                                    }

                    highscore.close();

                                   }
                 }
                 cin.ignore(10,'\n');

    cin.get();
            break;




 

}
}while(fail);

}

so here's the code open to all suggestions :o




 


#2TrickJay

Posted 03 May 2013 - 12:36 PM

#include <iostream>
#include <iomanip>
#include <fstream>
#include <string>

using namespace std;
struct highscore{
int svar;
};

struct game{
int fraga[1][2][3][4][5];
int val;
};


int main(){
    ofstream game;
    ofstream highscore;
    bool fail = true;
    int lost, fraga[10], svar = 0; // these are for the Start option
    int load ,loadh, loadg, tillbaka; // these are for the loading option
    string line, line2; // also loading option
    char val;

    game.open("game.txt", ios::app);
    if (!game){
        cout << "file could not open";
        exit (1);
    }

    do{
        cout << " Menu" << endl;
        cout << " 1. Start" << endl;
        cout << " 2. Load" << endl;
        cout << " 3. Credits" << endl;
        cin >> val;
        switch(val){

              case '1':

                      highscore.open("Highscore.txt", ios::app);
                      if (!highscore){
                      cout << "file could not open";
                      exit (1);
                      }
                         cout << "WELCOME TO THE CISCO QUIZ  GOOD LUCK" << endl;
                         cout << "how many layers are there in the OSI model?" << endl;
                         cout << "1. 4" << endl;
                         cout << "2. 5" << endl;
                         cout << "3. 7" << endl;
                         cin >> fraga;
                         switch(fraga){
                                      case 1:

                                           cout << "Game Over!" << endl;
                                           cout << "Do you wish to restart? (answer with 1 for yes and 2 for no)" << endl;
                                           cin >> lost;
                                           if(lost == 2 ){
                                                   fail = false;
                                                   }
                                           break;

                                      case 2:

                                           cout << "Game Over!" << endl;
                                           cout << "Do you wish to restart? (answer with 1 for yes, 2 for no)" << endl;
                                           cin >> lost;
                                           if(lost == 2 ){
                                                   fail = false;
                                                   }
                                           break;

                                      case 3:
                                           svar = svar + 5;
                                           break;
                                      default:
                                        cout << "error" << endl;
                                           }

                                           if(svar == 5){
                                              cout << "what is the full name of OSPF?" << endl;
                                              cout << "1. Open Shortest Path First" << endl;
                                              cout << "2. Online Shooting Pro Fishing" << endl;
                                              cout << "3. On Short Path First" << endl;
                                              cin >> fraga;
                                              switch(fraga){

                                                              case 1:
                                                              svar = svar + 5;
                                                                   break;

                                                              case 2:
                                                                   cout << "Game Over!"<< endl;
                                                                   cout << "Do you wish to restart? (answer with 1 for yes, 2 for no)" << endl;
                                                                   cin >> lost;
                                                                   if(lost == 2 ){
                                                                      fail = false;
                                                                      }
                                                                   break;


                                                              case 3:
                                                                   cout << "Game Over!" << endl;
                                                                   cout << "Do you wish to restart? (answer with 1 for yes, 2 for no)" << endl;
                                                                   cin >> lost;
                                                                   if(lost == 2 ){
                                                                      fail = false;
                                                                     }
                                                                     }
                                                                     }
                         if(svar == 10){
                         cout << "What does TTL mean?" << endl;
                         cout << "1. Twin Twitched Life" << endl;
                         cout << "2. Two Time Lives" << endl;
                         cout << "3. Time To Live" << endl;
                         cin >> fraga;
                           switch(fraga){
                             case 1:
                              cout << "Game Over!" << endl;
                              cout << "Do you wish to restart? (answer with yes, YES or Yes)"<< endl;
                              cin >> lost;
                                      if(lost == 2 ){
                                         fail = false;
                                           }
                             break;


                           case 2:
                             cout << "Game Over!" << endl;
                             cout << "Do you wish to restart? (answer with 1 for yes and 2 for no)" << endl;
                             cin >> lost;
                                if(lost == 2 ){
                                     fail = false;
                                         }
                           break;


                           case 3:
                           svar = svar + 10;
                           break;
                           }
                           }
                          if(svar == 20){
                                  cout << "What is the first command you enter on a Cisco router?" << endl;
                                  cout << " 1. enable"<< endl;
                                  cout << " 2. disable" << endl;
                                  cout << " 3. enter" << endl;
                                  cin >> fraga;

                                  switch(fraga){
                                                case 1:
                                                     svar = svar + 5;
                                                     break;

                                                case 2:
                                                     cout << "Game Over!" << endl;
                                                     cout << "Do you wish to restart? (answer with 1 for yes and 2 for no)" << endl;
                                                     cin >> lost;
                                                      if(lost == 2 ){
                                                           fail = false;
                                                                   }
                                                     break;
                                                case 3:
                                                     cout << "Game Over!" << endl;
                                                     cout << "Do you wish to restart? (answer with 1 for yes and 2 for no)" << endl;
                                                     cin >> lost;
                                                      if(lost == 2 ){
                                                         fail = false;
                                                                    }
                                                     break;
                                                     }
                                                     }
                                                                                          if(svar == 25){
                                              cout << "which protocol is the most prefered?" << endl;
                                              cout << " 1. RIP" << endl;
                                              cout << " 2. EGRP" << endl;
                                              cout << " 3. EIGRP" << endl;
                                              cin >> fraga;
                                              switch(fraga){
                                                            case 1:
                                                                   cout << "Game Over!" << endl;
                                                                   cout << "Do you wish to restart? (answer with 1 for yes and 2 for no)" << endl;
                                                                   cin >> lost;
                                                                       if(lost == 2 ){
                                                                           fail = false;
                                                                                     }
                                                                   break;


                                                             case 2:
                                                                  cout << "Game Over!"<< endl;
                                                                  cout << "Do you wish to restart? (answer with 1 for yes and 2 for no)" << endl;
                                                                  cin >> lost;
                                                                   if(lost == 2 ){
                                                                        fail = false;
                                                                                 }
                                                                    break;


                                                            case 3:
                                                                 svar = svar + 15;
                                                                 cout << "You have completed the game press 1 to exit or if you wish to do it again or check highscores press 2" << endl;
                                                                 cin >> lost;
                                                                 if (lost != 1 ){
                                                                          fail = false;
                                                                          }
                                                                 break;
                                                            }
                                                        }
                                                  highscore <<"Score: " << svar << '\n';
                                              highscore.close();
                                              game << fraga << val;
                                              game.close();
                                              cin.ignore(10,'\n');

                                              cin.get();

         case '2':
            cout << "type 1 to load game or type 2 to load highscores" << endl;
            cin >> load;
            if (load == 1){
                     ifstream loadg ("game.txt");
                 if (loadg.is_open())
                 {
                  while ( loadg.good() )
                  {
                   getline (loadg,line2);
                           cout << line2 << endl;
                       }
                       cout << "do you wish to return to the menu press 1 else press any number" << endl;
                       cin >> tillbaka;
                       if (tillbaka != 1){
                                    fail = false;
                                    }
                                    game.close();
                 }
            else if(load == 2){
                 ifstream loadh ("highscore.txt");
                 if (loadh.is_open())
                 {
                  while ( loadh.good() )
                  {
                   getline (loadh,line);
                           cout << line << endl;
                       }
                       cout << "do you wish to return to the menu press 1 else press any number" << endl;
                       cin >> tillbaka;
                       if (tillbaka != 1){
                                    fail = false;
                                    }

                    highscore.close();

                                   }
                 }
                 cin.ignore(10,'\n');

    cin.get();
            break;




 }

}
}while(fail);

}



 


#1TrickJay

Posted 03 May 2013 - 12:02 PM

#include <iostream>
#include <iomanip>
#include <fstream>
#include <cstdlib>
#include <string>
using namespace std;
struct highscore{
int svar;
};

struct game{
int fraga;
int val;
};


int main(){
    ofstream game;
    ofstream highscore;
    bool fail = true;
    int lost, fraga[10], svar = 0; // these are for the Start option
    int load ,loadh, loadg, tillbaka; // these are for the loading option
    string line, line2; // also loading option
    char val;

    game.open("game.txt", ios::app);
    if (!game){
        cout << "file could not open";
        exit (1);
    }

    do{
        cout << " Menu" << endl;
        cout << " 1. Start" << endl;
        cout << " 2. Load" << endl;
        cout << " 3. Credits" << endl;
        cin >> val;
        switch(val){

              case '1':

                      highscore.open("Highscore.txt", ios::app);
                      if (!highscore){
                      cout << "file could not open";
                      exit (1);
                      }
                         cout << "WELCOME TO THE CISCO QUIZ  GOOD LUCK" << endl;
                         cout << "how many layers are there in the OSI model?" << endl;
						 cout << "1. 4" << endl;
						 cout << "2. 5" << endl;
						 cout << "3. 7" << endl;
                         cin >> fraga[1];
                         switch(fraga[1]){
                                      case 1:

                                           cout << "Game Over!" << endl;
                                           cout << "Do you wish to restart? (answer with 1 for yes and 2 for no)" << endl;
                                           cin >> lost;
                                           if(lost == 2 ){
                                                   fail = false;
                                                   }
                                           break;

                                      case 2:

                                           cout << "Game Over!" << endl;
                                           cout << "Do you wish to restart? (answer with 1 for yes, 2 for no)" << endl;
                                           cin >> lost;
                                           if(lost == 2 ){
                                                   fail = false;
                                                   }
                                           break;

                                      case 3:
                                           svar = svar + 5;
                                           break;
									  default:
										cout << "error" << endl;
                                           }

                                           if(svar == 5){
                                              cout << "what is the full name of OSPF?" << endl;
                                              cout << "1. Open Shortest Path First" << endl;
                                              cout << "2. Online Shooting Pro Fishing" << endl;
                                              cout << "3. On Short Path First" << endl;
                                              cin >> fraga[2];
                                              switch(fraga[2]){

                                                              case 1:
                                                              svar = svar + 5;
                                                                   break;

                                                              case 2:
                                                                   cout << "Game Over!"<< endl;
                                                                   cout << "Do you wish to restart? (answer with 1 for yes, 2 for no)" << endl;
                                                                   cin >> lost;
                                                                   if(lost == 2 ){
                                                                      fail = false;
                                                                      }
                                                                   break;


                                                              case 3:
                                                                   cout << "Game Over!" << endl;
                                                                   cout << "Do you wish to restart? (answer with 1 for yes, 2 for no)" << endl;
                                                                   cin >> lost;
                                                                   if(lost == 2 ){
                                                                      fail = false;
                                                                     }
                                                                     }
																	 }
                         if(svar == 10){
                         cout << "What does TTL mean?" << endl;
                         cout << "1. Twin Twitched Life" << endl;
                         cout << "2. Two Time Lives" << endl;
                         cout << "3. Time To Live" << endl;
                         cin >> fraga[3];
                           switch(fraga[3]){
                             case 1:
                              cout << "Game Over!" << endl;
                              cout << "Do you wish to restart? (answer with yes, YES or Yes)"<< endl;
                              cin >> lost;
                                      if(lost == 2 ){
                                         fail = false;
                                           }
                             break;


                           case 2:
                             cout << "Game Over!" << endl;
                             cout << "Do you wish to restart? (answer with 1 for yes and 2 for no)" << endl;
                             cin >> lost;
                                if(lost == 2 ){
                                     fail = false;
                                         }
                           break;


                           case 3:
                           svar = svar + 10;
                           break;
                           }
                           }
                          if(svar == 20){
                                  cout << "What is the first command you enter on a Cisco router?" << endl;
                                  cout << " 1. enable"<< endl;
                                  cout << " 2. disable" << endl;
                                  cout << " 3. enter" << endl;
                                  cin >> fraga[4];

                                  switch(fraga[4]){
                                                case 1:
                                                     svar = svar + 5;
                                                     break;

                                                case 2:
                                                     cout << "Game Over!" << endl;
                                                     cout << "Do you wish to restart? (answer with 1 for yes and 2 for no)" << endl;
                                                     cin >> lost;
                                                      if(lost == 2 ){
                                                           fail = false;
                                                                   }
                                                     break;
                                                case 3:
                                                     cout << "Game Over!" << endl;
                                                     cout << "Do you wish to restart? (answer with 1 for yes and 2 for no)" << endl;
                                                     cin >> lost;
                                                      if(lost == 2 ){
                                                         fail = false;
                                                                    }
                                                     break;
                                                     }
                                                     }
                                                     cout << svar;
                                      if(svar == 25){
                                              cout << "which protocol is the most prefered?" << endl;
                                              cout << " 1. RIP" << endl;
                                              cout << " 2. EGRP" << endl;
                                              cout << " 3. EIGRP" << endl;
                                              cin >> fraga[5];
                                              switch(fraga[5]){
                                                            case 1:
                                                                   cout << "Game Over!" << endl;
                                                                   cout << "Do you wish to restart? (answer with 1 for yes and 2 for no)" << endl;
                                                                   cin >> lost;
                                                                       if(lost == 2 ){
                                                                           fail = false;
                                                                                     }
                                                                   break;


                                                             case 2:
                                                                  cout << "Game Over!"<< endl;
                                                                  cout << "Do you wish to restart? (answer with 1 for yes and 2 for no)" << endl;
                                                                  cin >> lost;
                                                                   if(lost == 2 ){
                                                                        fail = false;
                                                                                 }
                                                                    break;


                                                            case 3:
                                                                 svar = svar + 15;
                                                                 cout << "You have completed the game press 1 to exit or if you wish to do it again or check highscores press 2" << endl;
                                                                 cin >> lost;
                                                                 if (lost != 1 ){
                                                                          fail = false;
                                                                          }
                                                                 break;
															}
                                                        }
                                                  highscore <<"Score: " << svar << '\n';
                                              highscore.close();
                                              game << fraga << val;
                                              game.close();
                                              cin.ignore(10,'\n');

                                              cin.get();

         case '2':
			cout << "type 1 to load game or type 2 to load highscores" << endl;
			cin >> load;
			if (load == 1){
                     ifstream loadg ("game.txt");
                 if (loadg.is_open())
                 {
                  while ( loadg.good() )
                  {
                   getline (loadg,line2);
                           cout << line2 << endl;
                       }
                       cout << "do you wish to return to the menu press 1 else press any number" << endl;
                       cin >> tillbaka;
                       if (tillbaka != 1){
                                    fail = false;
                                    }
                                    game.close();
                          }
                 }
            else if(load == 2){
                 ifstream loadh ("highscore.txt");
                 if (loadh.is_open())
                 {
                  while ( loadh.good() )
                  {
                   getline (loadh,line);
                           cout << line << endl;
                       }
                       cout << "do you wish to return to the menu press 1 else press any number" << endl;
                       cin >> tillbaka;
                       if (tillbaka != 1){
                                    fail = false;
                                    }

                    highscore.close();

                                   }
                 }
                 cin.ignore(10,'\n');

    cin.get();
			break;






}
}while(fail);

}




so this is my code as far as I have come feel free to say it's shitty but if so gimme a solution ;)


PARTNERS