Question: Convert these value returning functions into void functions. Make the necessary changes to the function header, body and prototype: 1. #include using namespace std; double

Convert these value returning functions into void functions. Make the necessary changes to the function header, body and prototype:

1.

#include

using namespace std;

double timesTen (double value);

int main()

{

double value = timesTen (10);

cout << "Ten times the value is: " << value << endl;

return 0;

}

double timesTen(double num)

{

return num * 10;

}

2.

#include

using namespace std;

double findAverage(int num1, int num2, int num3, int num4);

int main()

{

int num1, num2, num3, num4;

cout << "Please enter your number (1): ";

cin >> num1;

cout << "Please enter your number (2): ";

cin >> num2;

cout << "Please enter your number (3): ";

cin >> num3;

cout << "Please enter your number (4): ";

cin >> num4;

double value = findAverage(num1, num2, num3, num4);

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

return 0;

}

double findAverage(int num1, int num2, int num3, int num4)

{

return ((num1 + num2 + num3 + num4) / 4);

}

3.

#include

using namespace std;

double calDistance (int speed, int time);

int main()

{

double value = calDistance (40, 60);

cout << "Distance value is: " << value << endl;

return 0;

}

double calDistance (int speed, int time)

{

return speed * time;

}

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!