1answer.
Ask question
Login Signup
Ask question
All categories
  • English
  • Mathematics
  • Social Studies
  • Business
  • History
  • Health
  • Geography
  • Biology
  • Physics
  • Chemistry
  • Computers and Technology
  • Arts
  • World Languages
  • Spanish
  • French
  • German
  • Advanced Placement (AP)
  • SAT
  • Medicine
  • Law
  • Engineering
yanalaym [24]
4 years ago
7

Write a complete C++ program that is made of functions main() and rShift(). The rShift() function must be a function without ret

urn 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 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 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().

Engineering
1 answer:
erma4kov [3.2K]4 years ago
8 0

Answer:

Explanation:

attached is an uploaded picture to support the answer.

the program is written thus;

#include<iostream>

using namespace std;

// function declaration

void rShift(int&, int&, int&, int&, int&, double&);

int main()

{

   // declare the variables

   int a1, a2, a3, a4;

   int maximum = 0;

   double average = 0;

   // inputting the numbers

   cout << "Enter all the 4 integers seperated by space -> ";

   cin >> a1 >> a2 >> a3 >> a4;

   cout << endl << "Value before shift." << endl;

   cout << "a1 = " << a1 << ", a2 = " << a2 << ", a3 = "  

        << a3 << ", a4 = " << a4 << endl << endl;

   // calling rSift()

   // passing the actual parameters

   rShift(a1,a2,a3,a4,maximum,average);

   // printing the values

   cout << "Value after shift." << endl;

   cout << "a1 = " << a1 << ", a2 = " << a2 << ", a3 = "  

           << a3 << ", a4 = " << a4 << endl << endl;

   cout << "Maximum value is: " << maximum << endl;

   cout << "Average is: " << average << endl;

}

// function to right shift the parameters circularly

// and calculate max, average of the numbers

// and return it to main using pass by reference

void rShift(int &n1, int &n2, int &n3, int &n4, int &max, double &avg)

{

   // calculating the max

   max = n1;

   if(n2 > max)

     max = n2;

   if(n3 > max)

     max = n3;

   if(n4 > max)

     max = n4;

   // calculating the average

   avg = (double)(n1+n2+n3+n4)/4;

   // right shifting the numbers circulary

   int temp = n2;

   n2 = n1;

   n1 = n4;

   n4 = n3;

   n3 = temp;

}

You might be interested in
Problem a) – c): Use the method of joints, the method of sections, or both to solve the following trusses. Draw F.B.Ds for all y
Ghella [55]

Answer:

This is confusing sorry

Explanation:

7 0
3 years ago
The pressure gage on a 2.5-m^3 oxygen tank reads 500 kPa. Determine the amount of oxygen in the tank if the temperature is 28°C
s2008m [1.1K]

Answer:

19063.6051 g

Explanation:

Pressure = Atmospheric pressure + Gauge Pressure

Atmospheric pressure = 97 kPa

Gauge pressure = 500 kPa

Total pressure = 500 + 97 kPa = 597 kPa

Also, P (kPa) = 1/101.325  P(atm)

Pressure = 5.89193 atm

Volume = 2.5 m³ = 2500 L ( As m³ = 1000 L)

Temperature = 28 °C

The conversion of T( °C) to T(K) is shown below:

T(K) = T( °C) + 273.15  

So,  

T₁ = (28.2 + 273.15) K = 301.15 K  

Using ideal gas equation as:

PV=nRT

where,  

P is the pressure

V is the volume

n is the number of moles

T is the temperature  

R is Gas constant having value = 0.0821 L.atm/K.mol

Applying the equation as:

5.89193 atm × 2500 L = n × 0.0821 L.atm/K.mol × 301.15 K  

⇒n = 595.76 moles

Molar mass of oxygen gas = 31.9988 g/mol

Mass = Moles * Molar mass = 595.76 * 31.9988 g = 19063.6051 g

7 0
3 years ago
Conclusion. What process is responsible for the bubbling action of the organism? What is your evidence?
noname [10]

Answer:

Explanation:

Hands-on Activity Bubbling Plants Experiment to Quantify Photosynthesis ... After running the experiment, students pool their data to get a large sample ... Explain that photosynthesis is a process that plants use to convert light ... Describe a simple experiment that provides indirect evidence that photosynthesis is occurring.

Through photosynthesis, certain organisms convert solar energy (sunlight) into ... of our planet continuously and is transferred from one organism to another. Therefore, directly or indirectly, the process of photosynthesis provides most of the energy ... Biology in Action ... Chlorophyll is responsible for the green color of plants.Photosynthetic organisms capture energy from the sun and matter from the air to ... oxygen produced during photosynthesis makes leaf bits float like bubbles in water. ... their ability to carry out photosynthesis, the biochemical process of capturing ... this air is forced out and replaced with solution, causing the leaves to sink.

6 0
3 years ago
The expression with an AND operator ________ when the expression on its left is false and so it does not evaluate the expression
MatroZZZ [7]
It is the short circuit
3 0
3 years ago
A furnace uses preheated air to improve its fuel efficiency. Determine the adiabatic flame temperature when the furnance is oper
balu736 [363]

Answer:

2543 k

Explanation:

This problem can be resolved by applying the first law of thermodynamics

<u>Determine the adiabatic flame temperature</u> when the furnace is operating at a mass air-fuel ratio of 16 for air preheated to 600 K

attached below is a detailed solution

cp = 1200

8 0
3 years ago
Other questions:
  • Problem 7.16 (GO Tutorial) A cylindrical bar of steel 10.4 mm (0.4094 in.) in diameter is to be deformed elastically by applicat
    15·1 answer
  • ¿Existen formas verbales en singular y en plural?<br>POR FAVOR DIGAMEN EXAMEN TENGO HORITA
    5·1 answer
  • Technician A says that the first step in diagnosing engine condition is to perform a thorough visual inspection. Technician B sa
    8·1 answer
  • Guys, can you rate this toolbox, please. It is my DT project, made for car trips, what do you think of the idea/design/usability
    12·1 answer
  • you are given the following data set: 15, 12, 11, 13, 10, 23, 16, 18, 11, 8. find the values of the lower quartile, median, uppe
    13·1 answer
  • 2. A
    12·1 answer
  • Finally, identify at least three colleges, universities, or training programs that are suited to that career choice.
    10·1 answer
  • How long would it take a marble to travel down a 15 inch piece of cardboard at a 15 degree angle?
    12·1 answer
  • Question # 8
    15·1 answer
  • Give the largest positive number that can be represented in 13 bits for the two cases:
    8·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!