Guest User

cpp problem

a guest
Apr 11th, 2015
309
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 1.36 KB | None | 0 0
  1. #include <iostream>
  2. #include <limits>
  3. #include <cstdlib>
  4.  
  5. using namespace std;
  6.  
  7. //function to clear the screen (saves time)
  8. void cls() {
  9. system("clear");
  10. }
  11.  
  12. int classtype;
  13. char choice [1];
  14. int strength, mana, smarts;
  15.  
  16. int main() {
  17. cout << "Welcome to\n\n\n" << "   ___     _                        _       _     _   \n  / __|  _| |__  ___ _ _ _ __  __ _| |_ _ _(_)___| |_ \n | (_| || | '_ \\/ -_) '_| '_ \\/ _` |  _| '_| / _ \\  _|\n  \\___\\_, |_.__/\\___|_| | .__/\\__,_|\\__|_| |_\\___/\\__|\n      |__/              |_|                           \n\nthe game" << endl << "Press ENTER to continue...";
  18. //waits till enter is pressed to proceed
  19. cin.ignore(numeric_limits<streamsize>::max(), '\n' );
  20.  
  21. classselect:
  22. cls();
  23. cout << "select your class" << endl << endl << "Lance (1)" << endl << "Adam (2)" << endl << "Benson (3)" << endl << endl << ">";
  24. //saves to variable classtype
  25. cin >> classtype;
  26.  
  27. invalidclass:
  28. cls();
  29. if (classtype == 1) {
  30.     cout << "Are you sure you want to pick Lance? (Y/n)" << endl << endl << "stats:" << endl << "strength: 8" << endl << "mana: 2" << endl << "general smarts: 6" << "\n\n>";
  31.     cin >> choice[1];
  32.         if (choice[1] == 'y' xor 'Y') {
  33.             strength = 8;
  34.             mana = 2;
  35.             smarts = 6;
  36.             cls();
  37.             goto cont;
  38.         }
  39.         if (choice[1] != 'n' xor 'N') {
  40.             goto classselect;
  41.         }
  42.         else  {
  43.             goto invalidclass;
  44.         }
  45.     }
  46. cont:
  47.  
  48. }
Advertisement
Add Comment
Please, Sign In to add comment