Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

Please fix....... I keep get this error: $ gcc week1.c week1.c:1:20: fatal error

ID: 3584509 • Letter: P

Question

Please fix....... I keep get this error: $ gcc week1.c week1.c:1:20: fatal error: iostream: No such file or directory compilation terminated. #include using namespace std; int main() { srand((unsigned)time(0)); int choice; int compchoice = (rand()%2)+1; printf("Welcome to ~ Rock Paper Scissors ~!! I assume you know how to play,"); scanf(" so lets begin. You are playing against the computer. Type 0 for"); printf(" rock, 1 for paper, and 2 for scissors "); scanf(choice); if (choice == 0) { if (compchoice == 0) { printf("It's a tie! "); } else if (compchoice == 1) { printf("Paper beats rock! Sorry, you lose! "); } else if (compchoice == 2) { printf("Rock beats scissors! You win! "); } } if (choice == 1) { if (compchoice == 0) { printf("It's a tie! "); } else if (compchoice == 1) { printf("Paper beats rock! You win! "); } else if (compchoice == 2) { printf("Scissors beat paper! Sorry, you lose! "); } } if (choice == 2) { if (compchoice == 0) printf("It's a tie! "); else if (compchoice == 1) printf("Scissors beat paper! You win! "); else if (compchoice == 2) printf("Rock beats scissors! Sorry, you lose! "); } return 0; }

Explanation / Answer

use if else line until u reached to last condition. for the last case use only else condition instead of else if.