Advertisement
Guest User

Untitled

a guest
Apr 20th, 2014
59
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.13 KB | None | 0 0
  1. while(true)
  2. {
  3. cout << description.c_str() << "nn";
  4. int response = 0;
  5. do
  6. {
  7. cout << "What would you like to do?n";
  8. if(enemy)
  9. cout << "1) Attack the evil "
  10. << enemyName.c_str() << "n";
  11. else if(!enemy)
  12. cout << " 1) Move to the next room.";
  13. if(treasure)
  14. cout << " 2) Pick up the "
  15. << treasureName.c_str() << "n";
  16. cin >> response;
  17. }while(response < 1 || response > 2);
  18.  
  19. switch(response)
  20. {
  21. case 1 : if(enemy)
  22. {
  23. enemy = !enemy;
  24. cout << "You slay the deadly "
  25. << enemyName.c_str() << "n";
  26. }
  27. else if(!enemy)
  28. return;
  29. break;
  30. case 2: treasure = !treasure;
  31. cout << "You pick up the "
  32. << treasureName.c_str() << "n";
  33. break;
  34. }
  35. }
  36.  
  37. return;
  38.  
  39. if(enemy)
  40. { ...
  41. }
  42. else if(!enemy)
  43. {...
  44. }
  45.  
  46. case 2: treasure = !treasure;
  47. cout << "You pick up the "
  48. << treasureName.c_str() << "n";
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement