I have to make this an infinite loop and also make it go back to the start when a wrong character is an input. What to do?
This is my code so far:
#include
#include
int main ()
{
// Prompt user for input last choice contender
char c;
printf("Last choice: ");
c = getchar();
// If last choice is R, loser should play S
if (c == 'R'|| c == 'r')
{
printf("Your next move: S");
}
// Else if last choice is P, loser should play R
else if (c == 'P' || c == 'p')
{
printf("Your next move: R");
}
// Else if last choice is S, loser should play P
else if (c == 'S' || c == 's')
{
printf("Your next move: P");
}
// TO DO: If another character start over
else if (c != 'S'|| c != 's' || c != 'P' || c != 'p' || c != 'R'|| c != 'r')
}
// TODO: make an infinite loop / start over
JavaScript questions and answers, JavaScript questions pdf, JavaScript question bank, JavaScript questions and answers pdf, mcq on JavaScript pdf, JavaScript questions and solutions, JavaScript mcq Test , Interview JavaScript questions, JavaScript Questions for Interview, JavaScript MCQ (Multiple Choice Questions)