Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- #include <cstdlib>
- using namespace std;
- int main()
- {
- int num1, selection, selection2, selection3, selection4;
- cout << "Welcome to my program \n";
- cout << "We are going to play The Toothpick Game \n";
- cout << "Here are the rules : \n";
- cout << "1.Take turns picking up toothpicks. \n";
- cout << "2.During your turn, you can pick up either 1, 2, or 3 toothpicks. \n";
- cout << "3.Your goal is to NOT be the last one to pick up a toothpick. \n";
- cout << "\n";
- cout << "Now enter a number (1,2,3): ";
- cin >> selection;
- if (selection >= 2)
- {
- num1 = selection + 1;
- cout << " You chose " << selection <<" The computer picks " << num1 << endl;
- }
- cout <<"Now enter a Second number: ";
- cin >> selection2;
- if (selection >= 1)
- {
- num1 = selection2 + 1;
- cout << " You chose " << selection2 <<" The computer picks " << num1 << endl;
- }
- cout <<"Now enter a third number: ";
- cin >> selection3;
- if (selection == 3)
- {
- num1 = selection3 - 1;
- cout << " You chose " << selection3 <<" The computer picks " << num1 << endl;
- }
- cout <<"Now enter a fourth number: ";
- cin >> selection4;
- if (selection == 1)
- {
- num1 = selection3 - 1;
- cout << " You chose " << selection3 <<" The computer picks " << num1 << endl;
- }
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement