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
How do Web browsers interact with URL/URIs to navigate the internet
iVinArrow [24]

Answer:

They smart dats y!

Explanation:

6 0
3 years ago
Hi Im really a girl and i want to know how to change my username without having to make a new account?
bixtya [17]
No sadly.
You can change your e-mail, profile picture, but that's about it.
I didn't see an option to change your name.

7 0
3 years ago
Read 2 more answers
What kind of device is a printer? output or input
ANEK [815]
A printer is output. :)
8 0
3 years ago
In the well-known ____________________ attack, an attacker monitors (or sniffs) packets from the network, modifies them, and ins
Oduvanchick [21]

Answer:

MAN IN THE MIDDLE

Explanation:

Man in the middle attack is an attack where the attacker secretly relays and possibly alters the communications between two parties. When data is sent between a computer and a server, a cybercriminal can get in between and spy or eavesdrop.

A man in the middle attack can positions himself in a conversation between a user and an application in other to impersonate one of the parties, making it appear as if a normal exchange of information is underway.

In a man-in-the-middle cyber-attack, the attacker places themselves in between two devices and monitor packets from the network, modifies them, and inserts them back into the network without the other parties knowing.

3 0
3 years ago
Consider this binary search tree:______.
Nitella [24]

Answer:

The new root will be 2.

<em></em>

Explanation:

The binary tree is not properly presented (See attachment)

To answer this; first, we need to order the nodes of the tree in a pre-order traversal.

We use pre-order because the question says if something is removed from the left child.

So, the nodes in pre-order form is: 14, 2, 1, 5, 4, 16.

The root of the binary tree is 14 and if 14 is removed, the next is 2.

<em>Hence, the new root will be 2.</em>

7 0
2 years ago
Other questions:
  • Select the correct answer.
    8·2 answers
  • Based on the current economic situation do you expect the employment demand for graduating engineers to increase or decrease? Ex
    9·1 answer
  • Suppose your company has decided that it needs to make certain busy servers faster. Processes in the workload spend 60% of their
    5·1 answer
  • Graphic designers sometimes must adjust the spacing between letters so that the result looks right to them. This is called
    12·1 answer
  • This toolbar can be used to change the way the text in your presentation looks. Drawing
    5·2 answers
  • Universal Containers is tracking the interviewer's ratings of candidate in Salesforce. They would like to easily link the Candid
    5·1 answer
  • You're working in a table that has three columns and five rows. Since the first row will be a header row, you want it to span al
    6·1 answer
  • Hey, how is everyone????????????????????????????????
    8·2 answers
  • True false.
    10·2 answers
  • What is one of the advantages of using an algorithm to solve a puzzle like Kriss-Kross or Sudoku?
    13·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!