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
In short and brave what is technology?
emmainna [20.7K]

Answer:

technology is a whole means to provide goods needed for the survival and comfort of human life

8 0
3 years ago
Read 2 more answers
Which sequence of slides would be followed in a linear slideshow? A. slide 4 -&gt; slide 5 -&gt; slide 6 -&gt; slide 7 B. slide
Nina [5.8K]

i dont understand your qeution to be able to answer it

8 0
3 years ago
Read 2 more answers
On a digital clock the displayed time changes constantly (True or False)
Vlada [557]
The answer is true as it will change on its own
8 0
4 years ago
Question 4 Multiple Choice Worth 5 points)
Morgarella [4.7K]

The correct answer is Boolean logic.

Booleans are true or false statements.

An example of a while loop is:

while 1 < 5:

   #do something.

The Boolean statement is 1 < 5 which evaluates to true because 1 is less than 5.

I hope this helps!

3 0
3 years ago
Which printer management components would you use to view the port a printer uses? (select two. )
masya89 [10]

The printer management components one would use to view the port a printer uses are as follows;

  • Printer properties
  • Printer server properties

<h3>What is Printer management components?</h3>

The print management component provides a single interface where a user can open the print management utility and view all printers and print servers in the enterprise.

The port of a printer is the connector usually on the computer that allow communication with the printer.

Therefore, the printer management components one would use to view the port a printer uses are as follows;

  • Printer properties
  • Printer server properties

learn more on printers port here: brainly.com/question/17157651

#SPJ12

5 0
2 years ago
Other questions:
  • 5. If you are 16 to 20 years old, you are __________.
    14·1 answer
  • The two ways to use the help menu is by searching of the contents or searching the _____
    13·2 answers
  • Motivation is best defined as
    9·2 answers
  • Why is the following statement true - ideally, your information is abbreviated
    10·2 answers
  • Design by contract considers the software system to be a setof:
    10·1 answer
  • Write a modular program that accepts up to 20 integer test scores in the range of 0 to 100 from the user and stores them in an a
    9·1 answer
  • Mingji is working to transfer photos from her digital camera to her computer. While
    11·1 answer
  • When solving a problem in a group situation, which of the following traits should be demonstrated?
    8·1 answer
  • When you're writing for mobile devices, use ________ to present the most important information first and provide successive laye
    13·1 answer
  • You are asked to analyze events in a firewall log that occurred six months ago. when you analyze the log file, you notice events
    8·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!