We're going to play rock-paper-scissors and cham-cham-cham

Asked 2 years ago, Updated 2 years ago, 53 views

The problem is not that you play rock-paper-scissors first, but if you play Cham Cham Cham and look in the same direction, you win.

I called the first round function as below, but when I chose something like a computer, I tried to get input again, but it didn't come out of the infinite loop. Can you take a look at the whole thing? We need to win rock-paper-scissors and win the second round of Cham Cham Cham. We need to get one point and keep playing games, so that we can go out whenever we want to play quit. Help me! How do I organize the structure so that I can continue to get the current score after playing both games?

game

2022-09-20 19:27

2 Answers

First of all, I think it's because you keep receiving infinite loops when you draw with while True. I think you should receive it differently than while true.

If I were you, I'd make it like this on the main dish.

int main(){
int point=0;
int result=1;
while(result != 0)
    result = Rock-paper-scissors function; // determine the return value from the function
        switch(result){
        Case 0: // If you win, escape from the while door, Cham Cham Cham
        Case 1: // If tied
        case 2: // if true
        }
    }
result=1;
while(result != 0){
result = true true function;
        switch(result){
        case 0: // Increases by 1 point if won
        Case 1: // If tied
        case 2: // if true
        }

}


2022-09-20 19:27

It sounds like your language. I have to do Python


2022-09-20 19:27

If you have any answers or tips


© 2024 OneMinuteCode. All rights reserved.