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]
2 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]2 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
Match the order in which you should develop a plan:
Advocard [28]

Develop

Present

Approve

Brainliiest please?

4 0
2 years ago
What is the only language a microprocessor can process directly but most programmers almost never write programs in this code? Q
elixir [45]
A microprocessor can directly process machine code but most programmers almost never write in it.
C. Machine code
7 0
3 years ago
Read 2 more answers
Of the following, the greatest advantage of a database architecture is that
Zina [86]

Answer:

c.

Explanation:

Of the following, the greatest advantage of a database architecture is that data redundancy can be reduced. This refers to data being unintentionally repeated within the database causing space to be taken up unnecessarily. Database architecture allows for this problem to be addressed and prevented.

3 0
3 years ago
In Python, how would you print the first 4 characters of "Help me pass!"
Semenov [28]

Answer:

sample_str = "Help me pass!"

first_chars = sample_str[0:4]

print('First four character: ', first_chars)

Explanation:

sample_str = "Help me pass!"

first_chars = sample_str[0:4]

H has index 0, e has index 1, l has index 2, p has index 3. the space has an index as well, etc.

7 0
2 years ago
Where do you find the instructions, learning objectives, evaluation and scoring for this aba assignment?.
sp2606 [1]

The instructions, learning objectives, evaluation and scoring for Aba assignment can be found on Preamble of the Applied Behavior Analysis (ABA) assignment.

<h3>What is ABA?</h3>

Applied Behavior Analysis refers to a therapy that is based on the science of learning and behavior.

Hence, the instructions, learning objectives, evaluation and scoring for Aba assignment can be found on Preamble of the Applied Behavior Analysis (ABA) assignment.

Read more about ABA

<em>brainly.com/question/11449763</em>

6 0
2 years ago
Other questions:
  • In Linux, when logged in as a normal user with root privileges, which command must precede the apt-get command in the command li
    13·1 answer
  • Suppose that Alice wants to send Bob a 50 kilobyte message over a 1 Gbps link. The total time required to transmit the message (
    5·1 answer
  • What is Administrator windows 10
    8·1 answer
  • Does anyone know this page for drivers ed?
    9·1 answer
  • Explain in a few sentences the difference between analytical papers and argumentative papers.
    8·2 answers
  • Advantages and disadvantages of technology
    13·1 answer
  • A recursive method that computes the number of groups of k out of n things has the precondition that ______. n is a positive num
    12·1 answer
  • What is the key to satisfaction and success when choosing a career
    15·2 answers
  • A health care provider approaches Accenture to help them increase their efficiency through an advanced data science platform.Wha
    8·1 answer
  • It's generally best to use what types of sites for factual internet research? Select all that apply from the choices below.
    5·2 answers
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!