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
s2008m [1.1K]
3 years ago
12

Consider this data sequence: "fish bird reptile reptile bird bird bird mammal fish". Let's define a SINGLETON to be a data eleme

nt that is not repeated immediately before or after itself in the sequence. So, here there are four SINGLETONs (the first appearance of "fish", the first appearance of "bird", "mammal", and the second appearance of "fish"). Write some code that uses a loop to read a sequence of words, terminated by the "xxxxx". The code assigns to the variable n the number of SINGLETONs that were read. (For example in the above data sequence it would assign 4 to n. Assume that n has already been declared. but not initialized. Assume that there will be at least one word before the terminating "xxxxx". ASSUME the availability of a variable, stdin, that references a Scanner object associated with standard input.

Social Studies
1 answer:
Gekata [30.6K]3 years ago
4 0

Answer:

// See attachment for full source code and output

// Program was implemented using C++ Programming Language

// Comments are used for explanatory purpose

#include<iostream>

using namespace std;

int main()

{

int n = 0; // Declare and initialise an integer variable n to 0

string prev ="xxxxx", current, next; // Declare string variables prev, current and next.

// At the same time initialise variable string to xxxxx

cin>>current; // Accept input for variable current

//If current is not equal to prev, the following statement in between the loop will be executed

// Else the program is terminated

while(current!=prev)

{

cin>>next; // accept input for variable next

if(prev != current && current != next)

{

n++; // Increment n by 1

}

prev = current; //store the value of current in previous

current = next; // store the value of next in current

cout<<prev<<endl; // Print previous string

cout<<current<<endl; // Print current string

cout<<next<<endl; // Print next string

}

return 0;

}

You might be interested in
Easy points #2<br> who is this??
juin [17]

Answer:

Ticci Toby.

and then a bunch of extra words down here because i'm desperate for points lol

7 0
4 years ago
Read 2 more answers
Brandon left his house this morning without a sweatshirt. he cannot focus on his friend's presentation because he can't stop thi
Amiraneli [1.4K]

Base on the given scenario, the action of where Brandon can’t focus because he can’t stop thinking how cold he is, is an example of physical noise. Physical noise is being defined as a way of having to distract a person from acquiring the message or information because of the external factors that affects it.

7 0
3 years ago
What new technologies did armies in World War I use?
musickatia [10]
Machine guns, grenades, and artillery, along with essentially new weapons such as submarines, poison gas, warplanes and tanks.
3 0
3 years ago
Cooper's father is a corporate executive who works long hours. he travels several days throughout the month and spends very litt
dusya [7]

Psychologists then would describe Cooper as a father that has a neglectful style of parenting. He thinks his career is more vital than raising his son and he is not present even in the soccer games and works long hours as a corporate executive.

4 0
4 years ago
According to crate what are the nine changes induced by climate change in this setting
Jet001 [13]
<span>Rain variability is your asnwer</span>
3 0
3 years ago
Other questions:
  • When alicia found out that aaron had another girlfriend she didn't know about, she was hurt and felt betrayed. even though aaron
    6·1 answer
  • 1. How did the environment of Arabia serve as a form of protection during much of the region's history?
    12·1 answer
  • Stages of Child and Adolescent Development
    5·1 answer
  • In the small town of Brandon sociologists are collecting data on single-parent families vs. two-parent families. They are compar
    13·1 answer
  • What are some ways teams can benefit from diversity while also working together as a unit?
    12·1 answer
  • Which of the following is not a significant source of water pollution?
    12·2 answers
  • When Grace's Son's principal called to say that Chucky had been acting out during lunch, Grace was livid (very angry). She geare
    7·1 answer
  • What would you become in the future? How do you deal with that
    6·1 answer
  • By engaging in _______________, humans show love by doing things together, talking, or engaging in an enjoyable activity. a. aff
    15·1 answer
  • The nurse has accepted a job in a workplace where organizational power has a pronounced effect. this characteristic may have wha
    12·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!