Ask Question, Ask an Expert

+61-413 786 465

info@mywordsolution.com

Ask Computer Engineering Expert

1. The following loop is supposed to read some numbers until it reaches a sentinel (in this case -1). It is supposed to add all of the numbers except for the sentinel. If the data looks like:

12 5 30 48 -1

the program fails to do what it is purported to do. Correct it.

#include

using namespace std;
int main()
{
int total = 0,
count = 0,
number;

do
{
cin >> number;
total = total + number;
count++;
}
while (number != -1);

cout << "The number of data read is " << count << endl;
cout << "The sum of the numbers entered is " << total
<< endl;

return 0;
}

 

Computer Engineering, Engineering

  • Category:- Computer Engineering
  • Reference No.:- M91623804
  • Price:- $20

Priced at Now at $20, Verified Solution

Have any Question?


Related Questions in Computer Engineering

When we look at the ease to enter the different market

When we look at the ease to enter the different market structure, there is no doubt that 'monopoly' is the hardest. Why? -- There is only ONE firm that has established 'economies of scale' with the production of their go ...

You are requested to design an information technology

You are requested to design an Information Technology Infrastructure for an international nonprofit organization. The organization has six offices, one each in Ohio, Kentucky, Toronto, Michigan, Chicago, and Indiana. Col ...

Question how will you create the cicd process for this

Question: How will you create the CI/CD process for this application? Propose the tools, technologies required to achieve CI/CD in general. The response must be typed, single spaced, must be in times new roman font (size ...

Suppose a record has the following fields in this order a

Suppose a record has the following fields in this order: A character string of length 15, an integer of 2 bytes, a SQL date, and a SQL time (no decimal point). How many bytes does the record take if: Fields can start at ...

Regional blocs like the eu are straining the british have

Regional blocs like the EU are straining. The British have voted to Brexit! What has caused the tension and what does the future hold - for Brexit and beyond?

What are the key principles and tenets that any educated

What are the key principles and tenets that any educated person should know regarding the science of economics and their applicability in the world today?

With regards to data mining business analytics why is it

With regards to data mining/ business analytics, Why is it not ideal to evaluate a classifier's performance on the training data set?

What are your thoughts on grant writing and grant money

What are your thoughts on grant writing and grant money toward purchase? How essential is this practice when looking at gaining money toward purchases?

Remember all of the following steps when showing that a

Remember all of the following steps when showing that a problem D is NPcomplete: 1. Show that D is in NP by briefly explaining how to quickly verify a solution to it. 2. Choose another problem Q that is known to be NP-ha ...

1nbsphillary wants to go to disneyland in 425 years she

1) Hillary wants to go to Disneyland in 4.25 years. She wants to take her partner and 2 kids (4 people in Total). If it is going to cost $453.27 per person to go on the trip. -What will the cost be for the entire trip? - ...

  • 4,153,160 Questions Asked
  • 13,132 Experts
  • 2,558,936 Questions Answered

Ask Experts for help!!

Looking for Assignment Help?

Start excelling in your Courses, Get help with Assignment

Write us your full requirement for evaluation and you will receive response within 20 minutes turnaround time.

Ask Now Help with Problems, Get a Best Answer

Why might a bank avoid the use of interest rate swaps even

Why might a bank avoid the use of interest rate swaps, even when the institution is exposed to significant interest rate

Describe the difference between zero coupon bonds and

Describe the difference between zero coupon bonds and coupon bonds. Under what conditions will a coupon bond sell at a p

Compute the present value of an annuity of 880 per year

Compute the present value of an annuity of $ 880 per year for 16 years, given a discount rate of 6 percent per annum. As

Compute the present value of an 1150 payment made in ten

Compute the present value of an $1,150 payment made in ten years when the discount rate is 12 percent. (Do not round int

Compute the present value of an annuity of 699 per year

Compute the present value of an annuity of $ 699 per year for 19 years, given a discount rate of 6 percent per annum. As