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
son4ous [18]
3 years ago
5

"Simon Says" is a memory game where "Simon" outputs a sequence of 10 characters (R, G, B, Y) and the user must repeat the sequen

ce. 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
Computers and Technology
2 answers:
weqwewe [10]3 years ago
5 0

int main() {

string simon_Pattern;

string user_Pattern;

int userScore;

int i;

user_Score = 0;

simon_Pattern = "RRGBRYYBGY";

user_Pattern = "RRGBBRYBGY";

for (i = 0; i <= simson_pattern.length; i++) {

if (simon_Pattern[i] == user_Pattern[i]) {

user_Score = user_Score + 1;

} else {

break;

}

}

cout << "userScore: " << user_Score << endl;

return 0;

}

Here it uses two string variable to store “simson’s pattern and user’s pattern”. Then a “for loop” is executed till the end of the string. Inside the for loop both the strings are compared character by character and when found the score is added. If not for loop is exited and finally the score is displayed.

Fofino [41]3 years ago
5 0

Answer:

The code is given below in Java

Explanation:

import java.util.Scanner;

public class SimonSays

{

  public static void main(String[] args)

  {

      String simonPattern = "";

      String userPattern = "";

      int userScore = 0;

      int i = 0;

      userScore = 0;

      simonPattern = "RRGBRYYBGY";

      userPattern = "RRGBBRYBGY";

      for (i = 0; i < simonPattern.length(); i++)

      {

          if (simonPattern.charAt(i) == userPattern.charAt(i))

          {

              userScore = userScore + 1;

          }

          else

          {

              break;

          }

      }

      System.out.println("userScore: " + userScore);

      return;

  }

}

You might be interested in
Emma wants to create a web page for her school’s volleyball team. Which of these could she use?
ser-zykov [4K]

Answer:

Emma should use Chrome

3 0
3 years ago
How does consumption of alcohol affect your driving skills? Name three ways that alcohol can affect your driving.
Natali [406]

Drinking and driving is not recommended. You need your, hands, feet, brain, and eyes to maneuver around. Drivers must be alert and able to make judgments quickly. Drinking and driving can affect the driver in the following ways.

Judgment

The brain is the first part of the body that is affected by alcohol. Your ability to think clearly and plan ahead levels down to as low as .02%

Concentration

Alcohol can leave you concentrating on only one action. You need to stay focused on several things at once. Alcohol will interrupt your focus and might result to an accident. Many accidents are as a result of a short attention span or a distracted driver.

Vision

Alcohol, especially when taken in excess, will impair your eye movement. Not only will it slow down your eye muscle function but  will also reduce peripheral vision.

8 0
3 years ago
Read 2 more answers
Live.com is Microsoft's free web-based email provider.<br> A. True<br> B. False
Zigmanuir [339]
True Live.com is Microsoft's free web- based email provider
5 0
3 years ago
Ideation includes all of the following EXCEPT
chubhunter [2.5K]

i believe it would be either C or D im sorry i dont know the exact answer

5 0
3 years ago
Only one person can receive the same email at the same time true or false
nasty-shy [4]

Answer:

false

Explanation:

5 0
3 years ago
Other questions:
  • Jerry suspects that information about his internet usage was sent to external websites without his knowledge. He is wary about t
    7·1 answer
  • Im being timed please help!!
    7·2 answers
  • Who created apple and in what year was it created
    9·2 answers
  • Number Array Class
    5·1 answer
  • You should always assign the Needs Met rating before assigning the Page Quality rating, T or F ?
    6·2 answers
  • Match the image to the view type in a presentation program. scroll bar tool bar status bar menu bar provides an array of buttons
    10·2 answers
  • The ___ function can be entered by clicking the cell where you want to add the funtion such as cell J6. Then click the arrow nex
    6·1 answer
  • If a system contains 1,000 disk drives, each of which has a 750,000- hour MTBF, which of the following best describes how often
    15·1 answer
  • How is scale depicted on a flat video screen?
    13·1 answer
  • Differenciate between foreign key and primary key in database.
    8·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!