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
disa [49]
3 years ago
12

"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. C++
Ex: The following patterns yield a userScore of 4:

Ex: The following patterns yield a userScore of 9:

simonPattern: R, R, G, B, R, Y, Y, B, G, Y

userPattern: R, R, G, B, B, R, Y, B, G, Y

Result: Can't get test 2 to occur when userScore is 9
Computers and Technology
1 answer:
m_a_m_a [10]3 years ago
3 0

Answer:

#include <iostream>  // includes input output functions

#include <string> // used for string functions

using namespace std;   // identifies objects like cout , cin

int main() {  // body of the main function

int index;   // index position of the elements

simonPattern = "RRGBRYYBGY";   //stores simon pattern

userPattern = "RRGBBRYBGY";   //stores user pattern

int userScore = 0;  // used to store the user score

// loop compares characters of user and simon patterns

for ( index = 0; userPattern[index] == simonPattern[index]; ++index) {

     userScore = userScore +1; // adds to the user score

     if (userPattern[index] != simonPattern[index]){

//if user and simon pattern do not match

        break;      }   } // breaks the loop

cout << "userScore is  " << userScore; // prints the user score

Explanation:

The program compares the user pattern to simon pattern character by character and keeps adding one to the user score if the characters of both simon and user patterns match. The loop breaks if the character of user pattern does not match with that of simon matter. At the end the calculated user score is displayed in the output.

You might be interested in
For window 7 explain the steps you will use to find the available program you will list.
Alex_Xolod [135]
Follow these steps.
1. Make sure that your pc is on.
2. Press your Window key - on your bottom left of your keyboard you will see a window key. 
3. After pressing it will show a tab on your bottom left of your monitor.
4. On that tab you will see an (All Programs) text.
5. Click it and it will show all programs available on your pc.
8 0
3 years ago
How to deactivate the brainly app?​
galina1969 [7]

Answer:

Don't you just uninstall it?

Explanation:

5 0
2 years ago
Read 2 more answers
Which of the following best describes compounds.
Lemur [1.5K]
A. They can only be separate chemically
4 0
3 years ago
What is an RGB value?
jasenka [17]
Color's RGB value indicates its red, green, and blue intensity. Each intensity value is on a scale of 0 to 255, or in hexadecimal from 00 to FF.

RGB values are used in HTML, XHTML, CSS, and other web standards. For more, including visual samples and RGB values, see:
5 0
3 years ago
Display all 3-digit automorphic no.s.<br>Guys I need help!!!!!!<br>I WILL GIVE THE BRAINLIEST ❤️​
pshichka [43]

Answer:

hope my answer helps

Explanation:

Automorphic Number

Given a number N, the task is to check whether the number is Automorphic number or not. A number is called Automorphic number if and only if its square ends in the same digits as the number itself.

Examples :

Input : N = 76

Output : Automorphic

Explanation: As 76*76 = 5776

Input : N = 25

Output : Automorphic

As 25*25 = 625

Input : N = 7

Output : Not Automorphic

As 7*7 = 49

8 0
2 years ago
Read 2 more answers
Other questions:
  • How old is the oldest asian
    14·2 answers
  • ________ symbol is used in the "Advanced" section of the time range picker to round down to nearest unit of specified time.
    8·1 answer
  • What do you call a firewall that is connected to the internet, the internal network, and the dmz?
    13·1 answer
  • To hide the ribbon, ______ on any one of the tabs of the ribbon.
    10·1 answer
  • PLEASE ANYONE!!which present margins would be best to get the most information to fit on the page​
    13·2 answers
  • Prove each statement using a proof by exhaustion. For every integer n such that 0 lessthanorequalto n &lt; 3, (n + 1)^2 &gt; n^3
    9·1 answer
  • How to understand amortized analysis potential?
    12·1 answer
  • Can I change my username?
    6·1 answer
  • Select the correct answer.
    9·1 answer
  • Discussion Topic
    13·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!