#include <iostream>
usingnamespace std;
int mainagain();
int main() {
int total, g;
cout << "Welcome to my minus game" << endl << ":D" << endl;
cin >> total;
while (true) {
if ((total % 3) == 2) {
total = total - 2;
cout << "I minuses with 2." << endl;
} else {
total--;
cout << "I minuses with 1." << endl;
}
cout << "New total is " << total << endl;
if (total == 0) {
cout << "I win!" << endl;
break;
}
cout << "Write a number 1 or 2: ";
cin >> g;
while (g < 1 || g > 2) {
cout << "You can only write 1 or 2!" << endl;
cout << "You cant do that re-enter: ";
cin >> g;
}
total = total - g;
cout << "New total is: " << total << endl;
if (total == 0) {
cout << "You win!" << endl;
break;
}
}
system("PAUSE");
return 0;
}
if you need my quick unprofessional way of doing it, put it in a while loop with an int that equals 0 and when the game is over, ask if they want to play again, if yes, the int will not change causing it to loop over again, but if they want to quit, have the int change to 1 or something, then the program will return 0 and exit out!