1answer.
Ask question
Login Signup
Ask question
All categories
  • English
  • Mathematics
  • Social Studies
  • Business
  • History
  • Health
  • Geography
  • Biology
  • Physics
  • Chemistry
  • Computers and Technology
  • Arts
  • World Languages
  • Spanish
  • French
  • German
  • Advanced Placement (AP)
  • SAT
  • Medicine
  • Law
  • Engineering
DanielleElmas [232]
4 years ago
10

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 characters in two chracater vectors, simon_pattern and user_pattern. One point is added to user_score for each match. The game ends upon the first mismatch. Restrictions: The script must use break statement.
Computers and Technology
1 answer:
blondinia [14]4 years ago
7 0

Answer:

#include <stdio.h>  // header file

#include <string.h> // header file

int main()  // main function

{

char simonPattern[50];  // create array

char userPattern[50];  // create array

int userScore =0 ;  //variable declaration  

int k= 0; // variable declaration  

userScore = 0; // variable declaration

strcpy (simonPattern, "RRGBRYYBGY"); // copy the characters  

strcpy (userPattern, "RRGBBRYBGY");  // copy the characters  

for(k=0; simonPattern[k]!='\0'; k++)  // iterating the loop

{

if(simonPattern[k] == userPattern[k]) // checking the  condition

{

userScore++; // increment the value

}

else

{

break;  // break the loop

}

}

printf("User score = %d \n", userScore); // print the value

return 0;

}

Output:

user score = 4

Explanation of the program in steps is given below:

Step 1 : Declaring header files.

Step 2 : Creating main function.

Step 3 : Creating an array.

Step 4 : Declaring a variable then copy the characters with the help of "strcpy()" function.

Step 5 : Starts a loop, check the condition and incrementation in the value.

Step 6 : Print the value and return function.

You might be interested in
If 10 ft lb of torque is applied at gear A, then what is the output torque at gear D?
Mrrafil [7]
This is actually simple math.
Use the formula of Gear A/Torque > 12.8ft/lb/10 > 1.28.
Therefor the output torque is 1.28 for gear D.
6 0
3 years ago
Pls help! for computers edge 2021
KATRIN_1 [288]
I believe it is the first one, i did some research for this question
7 0
3 years ago
Please help me with question 1!
BaLLatris [955]

12,831 is the answer but if you care for the work then here it is:

Since its a percent then its a certain percentage of the whole. Therefore you take 13,650 x 94% or 0.94 which will give you the answer of the amount of people that are familiar with it.

4 0
3 years ago
Read 2 more answers
What do you like to play
Ad libitum [116K]

Answer:I like to play sports

Explanation:

3 0
3 years ago
Read 2 more answers
When you are saving a file, what does word suggest by default as the name of the document?
LenaWriter [7]
Whatever you have written on the page is what it'll name it.
5 0
3 years ago
Read 2 more answers
Other questions:
  • _____ provide the standards, syntax, statements, and instructions for writing computer software
    14·1 answer
  • Which of the preventive strategies is described below: Violence often escalates. Behaviors like excessive complaing, hostility,
    10·1 answer
  • Carol typed a memo to send to everyone in her department. To create this memo, she used a _____. spreadsheet word processor fax
    10·2 answers
  • The while loop is a pre-test loop? TRUE OR FALSE
    9·2 answers
  • New Jersey and New York have the highest state taxes in the United States. They also have high ratios of people moving out compa
    13·1 answer
  • Select the correct answer.
    12·1 answer
  • A prime number is an integer greater than 1 that is evenly divisible by only 1 and itself. For example, the number 5 is prime be
    11·1 answer
  • what social media application that affect our day to day activities, and how did it improve our skill
    9·1 answer
  • State Whether the given statement are TRUE OR FALSE. 13X1=13
    10·1 answer
  • How can I call moderator in braily app ???
    5·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!