Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

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

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image_2

Step: 3

blur-text-image_3

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Practical Oracle8I Building Efficient Databases

Authors: Jonathan Lewis

1st Edition

0201715848, 978-0201715842

More Books

Students also viewed these Databases questions

Question

2. What process will you put in place to address conflicts?

Answered: 1 week ago