Question: Program : Write a complete C++ program that is made of functions main() and rShift(). The rShift() function must be a function without return with

Program: Write a complete C++ program that is made of functions main() and rShift(). The rShift() function must be a function without return with 6 parameters. rShift() should do following.

  1. Shift the first 4 formal parameters' value one place to right circularly and send the updated values out to the caller function, i.e. main. Furthermore, after calling this function with the first 4 actual parameters, say a1, a2, a3, a4, and these actual parameters should shift their value one place to right circularly as well. That is, a1 takes a2's value, a2 takes a3's value, a3 takes a4's value, and a4 takes a1's value.
  2. Assuming that first 4 formal parameters of rShift are n1, n2, n3, and n4, rShift should calculate maximum and average of n1, n2, n3, and n4, and send results back to caller function, i.e. main.

The main() function should do the following:

  1. Read four integers from the user with proper prompt and save them to four local variables.
  2. Call the rShift() function with 6 actual parameters.
  3. Receive all results, i.e. four shifted integers, plus maximum and average from rShift(). Then print these numbers with proper prompt text.

Note:

  • No input and output with the user inside rShift() function. All input and output should be strictly limited inside main() function.
  • Both statistics must be calculated with basic C++ flow control statements, and cannot be implemented by calling library functions such as max().

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!