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
Windows _____ is a system notification utility and gives quick access to settings for items like screen brightness and network c
jasenka [17]

Answer:

Windows notification and action settings

Explanation:

Notification and action settings is a system settings as well as a notification utility that enables quick or easy access to settings for a number of items or features.

The items include network, tablet mode, mobile hotpot, night light, brightness, Bluetooth, airplane mode, all settings, VPN, focus assist, location, project and connect. It is important to note that all the listed items can be found in the notification and action settings of a windows 10 computer.

4 0
3 years ago
You want to add a new Product and Services entry to your client's QuickBooks Online company. The service is installation of a se
Kisachek [45]

Answer:  

The correct answer is Option 3: "Select Service"  

You have to select "Service" in the Second Step.  

Only after that, you'll be able to name the Service in the following step.  

Other options are invalid for a given question.

6 0
3 years ago
Configuring a firewall to ignore all incoming packets that request access to a specific port is known as ____.
Sati [7]

Answer: Logical Point Blocking

Explanation:

4 0
1 year ago
How could you insert a new row between rows 20 and 21?
love history [14]
<span>The Answer is C. Right-click row 21's row number, and then click Insert.

</span>
6 0
2 years ago
Read 2 more answers
A cell has an unlimited number of conditions for Conditional Formatting.<br> A.true<br> B.false
Mekhanik [1.2K]
I believe the answer is false.
I Hope this helps! :)
If you don't understand plz message me
If you do plz brainlest
Thank you!
7 0
3 years ago
Other questions:
  • A developer writes a trigger on the Account object on the before update event that increments a count field. A workflow rule als
    12·1 answer
  • When creating a software package, the software must be designed, the code must be written, and then the code must be tested. Thi
    6·1 answer
  • Impact of computer on education
    6·2 answers
  • ________ are found on the motherboard and are used to attach your hard disk.
    6·1 answer
  • Write an expression that executes the loop while the user enters a number greater than or equal to 0.
    10·1 answer
  • Someone once observed that "the difference between roles and groups is that a user can shift into and out of roles, whereas that
    13·1 answer
  • What are some difficulties in synchronizing audio and video during telecine transfer? (Select all that apply.)
    13·1 answer
  • Wrtie down some containerization technology.
    11·1 answer
  • In dos operating system ,write a command to delete the directory as well as the files of the directory ''world'' on drive E.
    15·1 answer
  • PLEASE HELP!
    12·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!