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
Please help me answer this<br><br>number 1..
beks73 [17]

Answer:

B. How well it conveys information

Explanation:

The most important thing is how we represent the data in a graphic to understand the purpose, we can make an example, but we're going to use the color, can be more effective in a weather chart, for temperatures or clouds, but in an organization, we can use color on red or green numbers, in this way to convey bad and good numbers.

4 0
3 years ago
Explain the difference between IPv4 and IPv6.
Leni [432]

Answer:

The Internet Protocol version 4 (IPv4) is a protocol for use on packet-switched Link Layer networks (e.g. Ethernet). IPv4 provides an addressing capability of approximately 4.3 billion addresses. The Internet Protocol version 6 (IPv6) is more advanced and has better features compared to IPv4.

Explanation:

Without IP addresses, computers would not be able to communicate and send data to each other. It's essential to the infrastructure of the web. A: IPv6 is the sixth revision to the Internet Protocol and the successor to IPv4

5 0
3 years ago
The random module is a group of functions that are used to deal with random numbers.
maksim [4K]
True because it is the
5 0
2 years ago
Read 2 more answers
HELP ASAP PLZZZZZ
musickatia [10]

Answer:

third one

Explanation:

3 0
2 years ago
How can a Word user insert a page break into a document to isolate a table on a new page?
ki77a [65]

Answer: hit control key and enter key at the same time.

Explanation:

on the keyboard hold down the control key and enter key.

6 0
2 years ago
Read 2 more answers
Other questions:
  • What are language standards? At this point in your study of programming, what do they mean to
    5·1 answer
  • An undesirable jagged appearance is referred to as
    7·2 answers
  • In this activity, you'll decide how a computer (in this case, a smartphone)
    12·1 answer
  • State two functions of windows environment​
    9·1 answer
  • Define a function typeHistogram that takes an iterator ""it"" (representing a sequence of values of different types) and builds
    12·1 answer
  • What is 36 Denary in Binary?? PLEASE ANSWER I WILL GIVE U BRAINLY!!
    9·2 answers
  • JUST MAXED OUT THE COMMENTS anyways come here
    7·2 answers
  • Can you please help me
    9·1 answer
  • In which generation microprocessor was developed short answer of computer science​
    7·1 answer
  • What is the most popular game design engine today
    7·2 answers
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!