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
son4ous [18]
3 years ago
5

"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. Assume simonPattern and userPattern are always the same length. Ex: The following patterns yield a userScore of 4: simonPattern: RRGBRYYBGY userPattern: RRGBBRYBGY
Computers and Technology
2 answers:
weqwewe [10]3 years ago
5 0

int main() {

string simon_Pattern;

string user_Pattern;

int userScore;

int i;

user_Score = 0;

simon_Pattern = "RRGBRYYBGY";

user_Pattern = "RRGBBRYBGY";

for (i = 0; i <= simson_pattern.length; i++) {

if (simon_Pattern[i] == user_Pattern[i]) {

user_Score = user_Score + 1;

} else {

break;

}

}

cout << "userScore: " << user_Score << endl;

return 0;

}

Here it uses two string variable to store “simson’s pattern and user’s pattern”. Then a “for loop” is executed till the end of the string. Inside the for loop both the strings are compared character by character and when found the score is added. If not for loop is exited and finally the score is displayed.

Fofino [41]3 years ago
5 0

Answer:

The code is given below in Java

Explanation:

import java.util.Scanner;

public class SimonSays

{

  public static void main(String[] args)

  {

      String simonPattern = "";

      String userPattern = "";

      int userScore = 0;

      int i = 0;

      userScore = 0;

      simonPattern = "RRGBRYYBGY";

      userPattern = "RRGBBRYBGY";

      for (i = 0; i < simonPattern.length(); i++)

      {

          if (simonPattern.charAt(i) == userPattern.charAt(i))

          {

              userScore = userScore + 1;

          }

          else

          {

              break;

          }

      }

      System.out.println("userScore: " + userScore);

      return;

  }

}

You might be interested in
A(n) _____ bus enables the central processing unit (CPU) to communicate with a system’s primary storage.
Jobisdone [24]
An Address bus enables the cpu to communicate with a system's primary storage.
4 0
3 years ago
How many bits can a memory chip with the below configuration support? For full credit, show how you got the answer.
tatiyna

Answer:

Total Memory= 4 KB = 4096 bytes = 32768 bits

Explanation:

<em><u>1. Data lines are 8 From D0 to D7</u></em>

so

Total memory at single address locations is 8 bits.

<em><u>2. Address lines are 12 (A0 to A11)</u></em>

There are 12 address lines but 3 out 12 are for selction of chip or memory bank.

so only 9 pins are there to address the locations on one chip.

Total No. of address locations on single chip = 2^9 = 512 locations

as 1 location is 1 byte so total memory of single chip is 512 bytes.

<u><em>3. Total Memory Bank </em></u>

There are total 3 selection pins for memory bank.

so

Total chips = 2^3 = 8.

<em><u>4. Total Memory </u></em>

Total size of 1 chip = 512 bytes

Total size of 8 chip = 8x512 bytes = 4096 bytes = 4096/1024 kb = 4 kb

<em>So total memory of system is 4 Kb = 4096 bytes = 32768 bits</em>

5 0
3 years ago
Formulas should follow the___
tatuchka [14]

Answer:

Order of operations

Explanation:

4 0
2 years ago
When microsoft released word for windows, wordperfect had about 80 percent of the word processing market. microsoft donated free
irina1246 [14]

When Microsoft donated copies of Word program to colleges and universities, the company Microsoft is using a Marketing Strategy in promoting the product. A good promotion will help the product to be known and by words of mouth it will basically promote the product and the users will definitely give comments on how the product performs.

7 0
3 years ago
To place the caption at the top of the image you will need to change the ________
makkiz [27]

wrong!! it was postion!!

4 0
3 years ago
Other questions:
  • Blender questions
    8·1 answer
  • Fill in the blank. Do not abbreviate.
    6·1 answer
  • . A register in a computer has a of bits. How many unique combinations can be stored in the register?
    5·1 answer
  • Unit 3 Computer Programming Study Guide
    6·1 answer
  • The Apple iPhone was a revolutionary product when it was introduced in 2007. To what extent do you agree or disagree with this s
    8·1 answer
  • you have a small network in your business with just a few network devices connected along with 22 linux computers and you want t
    7·1 answer
  • Write a C# program named DoubleDecimalTest thatdeclares and displays two variables - a double and a decimal.Experiment by assign
    9·1 answer
  • In design and implementation of any _____ reasoning application, there are 4 Rs involved: retrieve, reuse, revise, and retain.
    7·1 answer
  • How many of yall are willing to subscribe to my channel called "Space Juice" with around 245 subs?!​
    8·1 answer
  • NWhen you measure a person’s weight, you are measuring the
    15·2 answers
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!