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
The process of encoding messages or information in such a way that only authorized parties can read it is called ____________.
lukranit [14]

Answer:

Encryption

Explanation:

Encryption is a term in the field of computer security (Cryptology) this is a process of encoding information in a way that hackers and eavesdroppers cannot read. The process of encryption involves a plain text (message) been converted into a scrambled text (cipher text) with an encryption algorithm (key) in this way, if the message is intercepted by a hacker he/she is unable to read the contents. Only the authorized party with a decryption key will be able to decrypt back to a plain text and read the contents of the message

3 0
3 years ago
____ software is rights-protection software used to control the use of a work.
jeka57 [31]
<span>Cyclos is a project of STRO, a leading organisation on monetary innovations. Cyclos offers a complete on-line payment system with additional modules such as e-commerce and communication tools. [ [ The Cyclos platform permits institutions such as local banks and MFI`s to offer banking services that can stimulate local trade and development. Cyclos is also used by many organizations and</span>
3 0
3 years ago
Rows within a spreadsheet are identified by:
EleoNora [17]

Answer:

Option C: Numbers.

Explanation:

By default, rows within a spreadsheet are identified by Numbers i.e. 1,2,3,............

Total rows are 1048575 in one spreadsheet.

7 0
3 years ago
can someone tell me what to do i’m kinda stuck and don’t know what he’s telling me to do pls ill give brainlist and points
Alexandra [31]

Answer:

Well a debtor is basically someone owing someone money, basically someone in debt. He’s telling cup head boy to take care of the people who owe him or someone else their or his money. Thats basically it.

8 0
2 years ago
Which of the following refers to a technology with a three-dimensional computer simulation in which a person actively and physic
weqwewe [10]

Answer:

B. Virtual reality

Explanation:

In a virtual reality context, the visual and auditory senses of the user are fed by data (images, sounds) from the computer using a goggle and earphones.  That allows the person to be totally cut off her real physical environment and be totally immersed into the world (reality) managed by the computer.

Not to be confused with<u> augmented reality</u>, where the physical reality and perception of it aren't changed... but an additional layer of information is added on top of it.  Like pointing your phone camera to a building and getting information about the building displayed on your phone.

7 0
3 years ago
Other questions:
  • How do I make my own extension for chrome?
    7·1 answer
  • The function below takes a string argument sentence. Complete the function to return the second word of the sentence. You can as
    5·1 answer
  • Tools, documents, language and processes—these are examples of boundary objects. Which of the following is the best definition o
    11·1 answer
  • Toby has lost valuable data on his computer a number of times due to system crashes caused by viruses. He decides to invest in a
    13·1 answer
  • Small data files that are deposited on a user's hard disk when they visit a website are called _______.
    6·2 answers
  • Check My Work Sherri is considering replacing a processor on her laptop. The laptop is running slower than she would like. What
    9·1 answer
  • How much weight does a headgear need to carry
    9·1 answer
  • Name the first mechanical computer​
    11·1 answer
  • A ____________ protocol is software that provides or facilitates a connection in which no information is retained by either send
    13·1 answer
  • In order to view a page break what should you do
    8·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!