Can\'t get this program to run. Please show me what I am doing wrong. I\'m using
ID: 3584504 • Letter: C
Question
Can't get this program to run. Please show me what I am doing wrong. I'm using notepad++ and cygwin. #include using namespace std; int main() { srand((unsigned)time(0)); int choice; int compchoice = (rand()%2)+1; cout << "Welcome to ~ Rock Paper Scissors ~!! I assume you know how to play,"; cout << " so lets begin. You are playing against the computer. Type 0 for"; cout << " rock, 1 for paper, and 2 for scissors "; cin >> choice; if (choice == 0) { if (compchoice == 0) cout << "It's a tie! "; else if (compchoice == 1) cout << "Paper beats rock! Sorry, you lose! "; else if (compchoice == 2) cout << "Rock beats scissors! You win! "; } if (choice == 1) { if (compchoice == 0) cout << "It's a tie! "; else if (compchoice == 1) cout << "Paper beats rock! You win! "; else if (compchoice == 2) cout << "Scissors beat paper! Sorry, you lose! "; } if (choice == 2) { if (compchoice == 0) cout << "It's a tie! "; else if (compchoice == 1) cout << "Scissors beat paper! You win! "; else if (compchoice == 2) cout << "Rock beats scissors! Sorry, you lose! "; } return main(); }Explanation / Answer
Extra bracket
Related Questions
Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.