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
elixir [45]
4 years ago
15

Consider this data sequence: "3 11 5 5 5 2 4 6 6 7 3 -8". Any value that is the same as the immediately preceding value is consi

dered a CONSECUTIVE DUPLICATE. In this example, there are three such consecutive duplicates: the 2nd and 3rd 5s and the second 6. Note that the last 3 is not a consecutive duplicate because it was preceded by a 7.
Write some code that uses a loop to read such a sequence of non-negative integers , terminated by a negative number. When the code exits the loop it should print the number of consecutive duplicates encountered. In the above case, that value would be 3.
Computers and Technology
1 answer:
iris [78.8K]4 years ago
5 0

Answer:

Following is the source code required:

int entry_1 ,entry_2 = -1, consecutive_duplicates = 0;

do {

cin >> entry_1;

if ( entry_2 == -1)

{

entry_2 = entry_1;

}else

{

if ( entry_2  == entry_1 )

consecutive_duplicates++;

else

entry_2  = entry_1;

}

}

while(entry_1 > 0 );

cout << consecutive_duplicates;

Explanation:

Following is the explanation for given code:

  • 3 integers are declared as entry_1, entry_2  and consecutive_duplicates.
  • entry_2 = -1 (it will tell that the integers are non-zero)
  • user will enter the value for entry_1
  • The loop will be applied which will check for the value of entry_2. If entry_2 = -1, the value of entry_1 will be stored in entry_2 else it the value of entry_2 is already equal to entry_1, the integer consecutive_duplicate in increased by one.
  • Now the value of entry_1 is stored in entry_2 , so that next entity might be checked.
  • In the end, while the entry_1 is greater than zero (unless the last (negative)element of array is reached), print the integer consecutive_duplicates.

i hope it will help you!

You might be interested in
Most search engines provide specific pages on which you can search for____ and
vazorg [7]

Answer: c

Explanation: a

7 0
3 years ago
Read 2 more answers
6.4 Predicting Prices of Used Cars. The file ToyotaCorolla.csv contains data on used cars (Toyota Corolla) on sale during late s
Brums [2.3K]

Answer:

Compare the predictions in terms of the predictors that were used, the magnitude of the difference between the two predictions, and the advantages and disadvantages of the two methods.

Our predictions for the two models were very simmilar. A difference of $32.78 (less than 1% of the total price of the car) is statistically insignificant in this case. Our binned model returned a whole number while the full model returned a more “accurate” price, but ultimately it is a wash. Both models had comparable accuracy, but the full regression seemed to be better trained. If we wanted to use the binned model I would suggest creating smaller bin ranges to prevent underfitting the model. However, when considering the the overall accuracy range and the car sale market both models would be

Explanation:

8 0
4 years ago
High-end tools in project management software have enterprise and _____ functions that summarize and combine individual project
e-lub [12.9K]

Answer:

Portfolio management  is the correct option.

Explanation:

Project management software is that type of software that is used to accomplish the management related works such as planning, organizing, summarizing and many other works related to the management.

So, project management software is used for functioning the enterprise and portfolio management functions by which the employee combines and summarizes project information.

8 0
4 years ago
Why are medical coders using encoded software
EastWind [94]
To keep the medical records confidential otherwise, hackers would take advantage of them and sell them to the highest bidder 
3 0
3 years ago
Which organization developed a network called CSNET to provide a network free to all American research and educational instituti
Citrus2011 [14]
<span>The National Science Foundation (NSF) is the organization which </span><span>developed a network called CSNET to provide a network free to all American research and educational institutions. It is an agency in the government of the United States that is responsible for research and development in the field of science and engineering. </span>
7 0
4 years ago
Other questions:
  • 1.
    13·1 answer
  • The concept of vertical farming allows agriculture to occur when there is not enough___Available .
    13·1 answer
  • Im trying to learn c# for unity does anyone know any good sources
    10·1 answer
  • What does the term World Wide Web refer to?
    5·2 answers
  • What does AAC stand for?
    11·2 answers
  • How can you enter Task Manager in Windows? Select 3 options. press Ctrl + Shift + Tab press Ctrl+Alt+Delete and then click Task
    8·1 answer
  • Supports traditional transactional processing for day-to-day front-office operations or systems that deal directly with the cust
    11·1 answer
  • What is a benefit of an account with interest?
    5·1 answer
  • What is required to publish documents on the Web
    12·1 answer
  • What enables image processing, speech recognition, and complex game play in artificial intelligence?
    10·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!