Advertisement
Guest User

Untitled

a guest
Mar 3rd, 2015
187
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.50 KB | None | 0 0
  1. #include <iostream>
  2. #include <cstdlib>
  3. using namespace std;
  4.  
  5. int main()
  6. {
  7. int num1, selection, selection2, selection3, selection4;
  8.  
  9. cout << "Welcome to my program \n";
  10. cout << "We are going to play The Toothpick Game \n";
  11. cout << "Here are the rules : \n";
  12. cout << "1.Take turns picking up toothpicks. \n";
  13. cout << "2.During your turn, you can pick up either 1, 2, or 3 toothpicks. \n";
  14. cout << "3.Your goal is to NOT be the last one to pick up a toothpick. \n";
  15. cout << "\n";
  16.  
  17. cout << "Now enter a number (1,2,3): ";
  18. cin >> selection;
  19.  
  20. if (selection >= 2)
  21. {
  22. num1 = selection + 1;
  23. cout << " You chose " << selection <<" The computer picks " << num1 << endl;
  24. }
  25. cout <<"Now enter a Second number: ";
  26. cin >> selection2;
  27.  
  28. if (selection >= 1)
  29. {
  30. num1 = selection2 + 1;
  31. cout << " You chose " << selection2 <<" The computer picks " << num1 << endl;
  32. }
  33. cout <<"Now enter a third number: ";
  34. cin >> selection3;
  35.  
  36. if (selection == 3)
  37. {
  38. num1 = selection3 - 1;
  39. cout << " You chose " << selection3 <<" The computer picks " << num1 << endl;
  40. }
  41. cout <<"Now enter a fourth number: ";
  42. cin >> selection4;
  43.  
  44. if (selection == 1)
  45. {
  46. num1 = selection3 - 1;
  47. cout << " You chose " << selection3 <<" The computer picks " << num1 << endl;
  48. }
  49.  
  50. return 0;
  51. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement