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
Mademuasel [1]
3 years ago
15

Consider this data sequence: "fish bird reptile reptile bird bird bird mammal fish". There is a CONSECUTIVE REPETITION of length

3 (the three consecutive birds) and a CONSECUTIVE REPETITION of length 2 (the two reptiles). There are also several SINGLETONs of length 1 (a singleton fish, a singleton bird, a singleton mammal, and another singleton fish).
Write some code that uses a loop to reads in a sequence of words, terminated by the "xxxxx". The code assigns to t the number of CONSECUTIVE REPETITIONS that were read. (For example, in the above data sequence that value would be 2.) Assume that t has already been declared but not initialized. Assume that there will be at least one word before the terminating "xxxxx".
Computers and Technology
1 answer:
Kay [80]3 years ago
6 0

Answer:

The following code is written from C++ Programming Language.

num = 0;   //integer type variable is initialized

string pre = "xxxxx", current, next;   // three string type variable is initialized

cin >> current;   //get input from user

while (current != "xxxxx") {   //set while loop

cin >> next;   //get input from the user

if (pre != current && current != next) {   //set if statement

num++;

}

//swap the values.

pre = current;    

current = next;

}

Explanation:

Here, we initialized an integer type variable "num" to 0.

Then, we initialized the three string type variable "pre" to "xxxxx", "current", "next".

Then, we get input from the user in "current" and then, we set the while loop then, we get input from the user in "next".

Then, we set the if statement and increment the num variable by 1.

After all, we swap the variables.

You might be interested in
Which best describes IMEI?
KIM [24]

Answer:

A unique identifier for a wireless subscriber

3 0
3 years ago
How do companies use web sites?
kramer

they us websites to look thing up that are need

hope this helps

5 0
4 years ago
Anyone wanna join a supercar/hypercar enthusiast's club?
stellarik [79]

Answer:

I have Lamborghini Centenario as my profile pic. :)

Explanation:

7 0
4 years ago
Consider bears = {"Grizzly":"angry", "Brown":"friendly", "Polar":"friendly"}. Can you replace #blank# so the code will print a g
Goshia [24]

Answer:

bears = {"Grizzly":"angry", "Brown":"friendly", "Polar":"friendly"}

for bear in bears:

   if bears[bear] == "friendly":

       print("Hello, "+bear+" bear!")

   else:

       print("odd")

Explanation:

A dictionary called bears is given. A dictionary consists of key-value pairs.

You need to check each key-value pairs in bears and find the ones that have "friendly" as value using a for loop and if-else structure. In order to access the values of the dictionary, use the dictionary name and the key (inside the loop, the key is represented as bear variable). If a key has a value of "friendly", print the greeting. Otherwise, print "odd".

6 0
3 years ago
What are some cowboy ethics??
lys-0071 [83]

Answer:

giv meh a min plsssss

Explanation:

4 0
3 years ago
Other questions:
  • What is the Default path for SYSVOL?
    14·1 answer
  • As a member of the accounting group,
    10·1 answer
  • You are having trouble closing a program. You have tried to hit the Close button, the keyboard shortcut to close the program, an
    6·1 answer
  • In an SLR camera photogaphers look from the viewfinder through which of the following?
    13·2 answers
  • In a Microsoft Office application, what is the area at the bottom of the application screen that contains information about the
    13·1 answer
  • Your team will write a function that reverses a C-string, to practice using pointers. You must use pointers and C-strings for th
    6·1 answer
  • Can you awnser this question
    15·1 answer
  • '|'/2`/ '|'[] |)[-([]|)[- '|'#!$
    9·1 answer
  • Where is the element coded in a web page.
    13·1 answer
  • Topic: Drivers ed 100 points and brainliest!
    9·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!