Question: Please complete the following partial C++ program to read three positive integers x, y and z. Then, in each turn, the three values will

Please complete the following partial C++ program to read three positive integers

Please complete the following partial C++ program to read three positive integers x, y and z. Then, in each turn, the three values will be shifted to the right (the right-most one becomes the first one) and reduced by 1, and the sum of the three values will be printed. This process will be repeated until one of the value reaches O. #include using namespace std; / TODO: Write the shiftAndReduce(...) function here. (Hint: you can use reference parameters) */ The main() function. No modification is allowed. */ int main() { int x, y, z; cout < < "Input three numbers:" < < endl; cin>>>>y >> z; // Assume all inputs are positive while (x > 0 && y > 0 && z > 0) cout < < "sum = " < < shiftAndReduce(x, y, z) < < " : "; cout < < x < < " " < < y < < < < z < < < < endl; } return 0; Some sample runs are shown as follows (underlined bold characters in blue are user input): Sample Run 1 Input three numbers: 369 sum 15825 sum 12 4 7 1 sum 9:036 Sample Run 2 Input three numbers: 100 1 200 sum 298 199 99 0 Please name your C++ source file as Lab3Ex3.cpp.

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock

Here is the completed C program cpp include iostream using namespa... View full answer

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 Programming Questions!