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
Mashutka [201]
3 years ago
8

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 read 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:
ioda3 years ago
8 0

Answer:

The code is given below. Follow the question and the code definitions for better understanding.

Explanation:

#include<iostream>

#include<string>

using namespace std;

int main(){

string pastWord="";

string currentWord,nextWord;

int n,t;

int singleton=0;

int consecutive=0;

cout<<"Enter words. ('xxxxx' to exit):\n";

cin>>nextWord;

do{

currentWord=nextWord;

cin>>nextWord;

if ( (currentWord!=pastWord)&&(currentWord!=nextWord) )

singleton++;

else if((currentWord==pastWord)&&(currentWord!=nextWord))

consecutive++;

pastWord=currentWord;

}while(nextWord!="xxxxx");

n=singleton;

t=consecutive;

cout<<"There were "<<n<<" singletons and "<<t<<" consecutive repetitions.";

cin.get();

return 0;

}

You might be interested in
Which technological innovation was most important for early-nineteenth-century economic development?
Sonbull [250]

Answer:

Electricity

Explanation:

Innovation is the ability to create a new device or process, resulting from study and experiments. There were a couple innovations that came into existence in the early-nineteenth-century, but the most important is electricity.

The birth of electricity brought about a totally different means to solve man-powered labor. Hence, saving time and achieving more.

This also led to the innovation of various devices and processes that further paved way for more economic growth.

4 0
3 years ago
To change the size of a field or record by dragging its border a.resize b.magnify c.label d.enlarge
4vir4ik [10]
A. Resize

By dragging the border of a field or record, you are either enlarging it or compressing it. Choices "b" and "d" are only half correct, as there is always the possibility of making it smaller. Hope this helps!
6 0
3 years ago
Read 2 more answers
A/an<br> controls the flow of data between a computer and the network.
strojnjashka [21]

Answer:

The NIC (Network Interface Card)  is the computer network component that controls the flow of data between a computer and the network.

Explanation:

5 0
3 years ago
____ is a method of querying and reporting that takes data from standard relational databases, calculates and summarizes the dat
IgorLugansk [536]

Answer: Online analytical processing

Explanation:

Online analytical processing(OLAP) is the method through which multi-dimension analytical queries can be resolved.User can attain selected query data as per their selection and then assess and analyze them from different view point.

  • It helps in viewing and reporting , planning ,performing analytical calculation, collecting data in data cubes etc.
  • Other options are incorrect because data adjacency, Ad hoc reporting ,data segregation and E-discovery are not the mechanism through which query and storage of data in data cubes take place.
  • Thus, the correct option is online analytical processing
3 0
3 years ago
I don't understand how to write both. If I repeat the first code but with 3 and 6 it doesn't work.
hram777 [196]

It looks like you need to get both numbers from the input. Try doing something like this:

print(int(input()) + int(input()))

4 0
3 years ago
Other questions:
  • Including quotes in your paper can bring additional meaning to the content True are false
    11·2 answers
  • Which of the following is the definition of Internet Protocol Security ( IPSec)? A remote access client/server protocol. It is a
    13·2 answers
  • A machine that is used to print newspaper is a
    12·2 answers
  • You can remove selected text from a slide by pressing ctrl+x keyboard shortcut keys true or false
    7·1 answer
  • The default print setting for worksheets is________
    13·1 answer
  • Differentiate between email and NIPOST System
    12·1 answer
  • Some people worry that there won’t be enough jobs in the future because computers will be able to do everything better than peop
    7·2 answers
  • Who played Anne in the green gables??
    6·1 answer
  • During slide show mode, hitting the B key will do which of these things? end your presentation move back one page move to the fi
    15·1 answer
  • ____ is an example of a set of prewritten classes that allows you to access data stored in a database.
    8·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!