Question: C++ Please write a snippet of code executing a loop which: 1. processes a series of numeric inputs and sum up the square of the

C++

Please write a snippet of code executing a loop which:

1. processes a series of numeric inputs and sum up the square of the each input: C++ Please write a snippet of code executing a loop which: 1.?in?number2

3. uses any non-numeric input as sentinel for terminating input data

2. contains a flag (bool input_started) which is to be set inside the loop to indicate the loop has started, even when there is no valid data entered at all, i.e. the first input is non-numeric

4. has all of the statements which process the inputs located inside the loop only, including the one(s) which prompts for the all the inputs (cout)

5. declares some variables outside of the loop, naturally

6. doesn't use array, not necessary.

Hint: there are more than one way to implement, but only the efficient ones presented will receive full credit. Before coding, please think about all the available forms of loop and which one is the best choice for this problem. You also have to consider what essential variable(s), the types and so forth, need to be created for tracking the loop, and other local variables for the input value and computation result. If your solution is not complete but make some sense, you will get partial credit. Coding style and nomenclature compliance are not required for this question.

Here is a sample output:

enter a new input number, type any non-numeric key to end data input: 1 enter a new input number, type any non-numeric key to end data input: 2 enter a new input number, type any non-numeric key to end data input: 2.5 enter a new input number, type any non-numeric key to end data input: q sum of sq: 11.25 Press any key to continue . . .

? in. number,2

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!