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
You can post a Facebook status update from your smartphone. True or false?
Nady [450]
True .................
3 0
3 years ago
Read 2 more answers
Information​ technology, especially the use of​ networks, can help firms lower the cost of​ ________, making it worthwhile for f
aniked [119]

Answer:

MARKET PARTICIPATION.

Explanation:

<em>Because this way the firm size can stay constant or contract even if the company increases its revenues. Information technology helps firms contract in size because it can reduce transactions costs. According to the transaction cost theory, firms and individuals seek to economize on transaction costs, much as they do on prodcution costs. For instance, by using computer links to external suppliers, the Chrylser Corporation can achieve economies by obtaining more than 70 percent of its parts from other companies.</em>

5 0
3 years ago
What programs are most likely affected by a macro virus?
Iteru [2.4K]

Answer:

Macro viruses usually infect Microsoft Office apps like Word and Excel.

Explanation:

7 0
2 years ago
What is the first thing you should do when troubleshooting a computer problem?
hichkok12 [17]

Answer:

A. Identify and locate the problem.

Explanation:

A problem-solving process can be defined as the systematic approach to used to identify and determine the solution to a particular problem.

The first thing you should do when troubleshooting a computer problem is to identify and locate the problem.

Basically, when an administrator or network engineer is trying to proffer a solution to a computer or network-related problem, it is very important and essential for he or she to first identify what the problem is. This is necessary because it will help to ensure that his or her energy is channeled in the right direction.

Hence, once the problem is identified, then a theory of probable cause can be established.

6 0
3 years ago
Read 2 more answers
Jenna received an interesting email about dolphins that she wants to share with her brother. Which operation will allow Jenna to
KATRIN_1 [288]
The answer is Forward

5 0
3 years ago
Other questions:
  • I don’t know technically
    9·2 answers
  • What font option will elevate part of the text to a higher level and decrease its size? A. Subscript
    8·1 answer
  • Suppose your name was Alan Turing. Write a statement that would print your last name, followed by a comma, followed by a space a
    10·1 answer
  • Create the Following Menu in a loop so the menu will continually show until the user chooses to exit.AddMultiplyExitAdd a value
    10·1 answer
  • Marissa, a 21-year-old young woman, is working as an intern at a software company. She has recently graduated from college. She
    6·1 answer
  •  In which part of a professional email should you try to be brief, but highly descriptive? 
    10·1 answer
  • Which business case is better solved by Artificial intelligence than conventional programming?<br>​
    8·1 answer
  • Recently mobile phones have been used to pay for goods in stores and supermarkets. One method
    11·1 answer
  • Computer programming 3
    13·1 answer
  • Which term means a cryptography mechanism that hides secret communications within various forms of data?.
    6·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!