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
The term ________ refers to fluid flow back to the pan to empty or drain a circuit.
Strike441 [17]

The term is: transmission flush

8 0
3 years ago
A word I know, six letters it contains, remove one letter and 12 remains, what is it?
gulaghasi [49]

Answer:

dozens

Explanation:

3 0
3 years ago
Methods for preventing/overcoming group conflict include all EXCEPT:
kondor19780726 [428]

Answer:

recognizing that gender differences are a myth.

Explanation:

The options are:

  • active listening.
  • recognizing that gender differences are a myth.
  • structured debate.
  • building cross-cultural understanding

Without active listening, structured debate, and cross-cultural understanding group conflict are definitely on the card. However, no one now is concerned about gender differences. As now both the genders are already having the equal status in at least developed countries. However, this too can play a role in avoiding group conflict. However, since this is not that important considering the current context, this looks like being the correct option here. Hence, the above mentioned in the answer section is the correct option.

7 0
3 years ago
This question refers to a standard deck of playing cards. If you are unfamiliar with playing cards, there is an explanation in P
Norma-Jean [14]

Answer:

Explanation:

Number of ways to select 10 girls in 35C₁₀

Number of ways to select 10 boys in 35C₁₀

Total Number of ways to select is 35C₁₀ x 35C₁₀

4 0
3 years ago
Read 2 more answers
What is the best approach to testing a website
Ronch [10]

A vital part of any website project is the quality assurance stage. Prior to launch, final QA testing ensures that your site is working according to your expectations and that your site users won’t be frustrated with any non-functioning pages.

7 0
3 years ago
Other questions:
  • Compare and contrast the TwoFish encryption algorithm with the DES and AES algorithms. In your comparison be sure to compare and
    6·1 answer
  • Write a program to read as many test scores as the user wants from the keyboard (assuming at most 50 scores). Print the scores i
    13·1 answer
  • Energy is defined as stored energy
    13·2 answers
  • The date June 10, 1960, is special because when it is written in the following format, the month times the day equals the year:
    5·1 answer
  • _____ are types of changes that occur when text has been omitted from a document and must be inserted later.
    8·2 answers
  • What do developers do to support software products? explain to users which development process model was used to make the produc
    8·1 answer
  • What are three requirements of information technology a. Accuracyb. _______________________________c. __________________________
    13·1 answer
  • In the United States, everyone is guaranteed work true or false
    13·1 answer
  • Deciding whether to explode a process further or determine that it is a functional primitive is a matter of experience, judgment
    8·1 answer
  • Define the following term. data, database, DBMS, database system, data- base catalog, program-data independence, user wen', DBA,
    12·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!