Computers and Technology

SOLVE IN C: "Simon Says" is a memory game where "Simon" outputs a sequence of 10 characters (R, G, B, Y) and the user must repeat the sequence. Create a for loop that compares the two strings starting from index 0. For each match, add one point to userScore. Upon a mismatch, exit the loop using a break statement. Assume simonPattern and userPattern are always the same length. Ex: The following patterns yield a userScore of 4:

simonPattern: RRGBRYYBGY
userPattern: RRGBBRYBGY
please use comments to explain each step!! I would like to understand the process :)

#include
#include

int main(void) {
char simonPattern[50];
char userPattern[50];
int userScore;
int i;

userScore = 0;

scanf("%s", simonPattern);
scanf("%s", userPattern);

**YOUR ANSWER GOES HERE**

printf("userScore: %d\n", userScore);

return 0;
}

answer
Answers: 1

Other questions on the subject: Computers and Technology

image
Computers and Technology, 23.06.2019 04:31, hargunk329
Q13 what function does a security certificate perform? a. creates user accounts b. scrambles data c. identifies users d. creates password policies e. provides file access
Answers: 1
image
Computers and Technology, 23.06.2019 15:00, hunteryolanda82
Based on the current economic situation do you expect the employment demand for graduating engineers to increase or decrease? explain the basis for your answer. with a significant economic recovery, what do you think will happen to future enrollments in graduating engineering programs?
Answers: 1
image
Computers and Technology, 23.06.2019 17:00, Need1ng
The more powerful, 60 volt cables and the main power shut-off on an hev are both colored orange.
Answers: 1
image
Computers and Technology, 24.06.2019 10:00, shrafe
Which two technologies support the building of single-page applications?
Answers: 2
Do you know the correct answer?
SOLVE IN C: "Simon Says" is a memory game where "Simon" outputs a sequence of 10 characters (R, G, B...

Questions in other subjects:

Konu
Mathematics, 22.05.2020 20:57