[ create a new paste ] login | about

Link: http://codepad.org/Rotbu358    [ raw code | output | fork ]

C++, pasted on Dec 6:
 game:

  clear;

  string restart;

  ifstream money ("score.txt");
  if (!money.is_open()) {
    string create_score_file;
    cout<<"Score file could not be loaded.  Would you like me to create one for you? (yes/no): ";
    cin>> create_score_file;
    if (create_score_file == "no") {
      return 1;
    }
    else if (create_score_file == "yes") {
      int score = 100;
      ofstream money_write("score.txt");
      money_write<< score;
      money_write.close();
      cout<<"Score file created.  Would you like to restart the game? (yes/no): ";
      cin>> restart;
      if (restart == "no") {
        return 1;
      }
      else if (restart == "yes") {
        goto game;
      }
      else {
        cout<<"Invalid Option "<< restart << endl;
        return 1;
      }
    }
    else {
      cout<<"Invalid Option "<< restart << endl;
      return 1;
    }
  }
  else {
    score = money;
    money.close()
  }


Output:
1
2
Line 1: error: invalid function declaration
compilation terminated due to -Wfatal-errors.


Create a new paste based on this one


Comments: