Assignment I

Primary focus on chapter 6 Functions

For each problem:

Additional requirement:
In these problems, and all future problems, use functions.
Provide a function prototype for each function before the main function.
The function prototype should have descriptive names for the function and for each parameter.
Put very little code in the main function.
Each function should be preceded with a short comment giving:

Problem I1

In the main function, define four variables of type int, named: first, second, third, and total.
Write a function named getData that asks the user to input one integer and returns the value read from the user.

Print a message asking the user to enter the first integer.
Call the function getData and save the value returned in the variable first.

Print a message asking the user to enter the second integer.
Call the function getData and save the value returned in the variable second.

Print a message asking the user to enter the third integer.
Call the function getData and save the value returned in the variable third.

Write a function named computeTotal that computes and returns the total of three integers.
Write a function named printAll that prints all the values in the format shown in the following sample:

1 + 2 + 3 = 6
  

Call all the functions from the main function.

Test it once, with the values 4, 5, and 6.

Problem I2

In the main function, define four variables of type int, named: first, second, third, and total.
Write one function named getData that asks the user to input three integers and stores them in the variables first, second, and third which are in the main function.
Write a function named computeTotal that computes and returns the total of three integers.
Write a function named printAll that prints all the values in the format shown in the following sample:

1 + 2 + 3 = 6
  

Call the other three functions from the main function.

Test it once, with the values 4, 5, and 6.