### Assignment G

For each problem:

• Use the lab instructions given on the Internet at http://voyager.deanza.edu/~oldham
• Use the same format for the opening comments as in assignment A, with your name, course and quarter, assignment, problem, and short problem description.
• Create a program to meet the requirements of the problem.
• Correct any errors.
• Run the program with the specified data and save the execution results in an Execution Results comment at the end of your program.
• Print the program from Code::Blocks.
• Staple all the problems for this assignment together.

In problems G2, G3, 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:

• A long line of asterisks as an eye catcher
• The purpose of the function
• Parameters, other input, and initial conditions
• Return values, other results, and final conditions provided

### Problem G1

This program will read integers from a file and find results from these integers.

Open the file, test to make sure the file opened. Use a loop to read the integers and process each integer as it is read. When End Of File is reached, close the file.

After all of the integers have been read and processed, print the results for the following output:

• The integer count:
• The sum of the integers:
• The smallest integer:
• The largest integer:
• The average of the integers:

Use notepad, vim, or other simple text editor to create a file named `file1.txt` containing the following, with one integer per line.

Test the program two times.

Use the following data in the first test:

```11
9
18
22
27
33
21
```

For the second test add an additional line containing the number 40.

### Problem G2

Write two functions:
A function named sum which takes two integer values as arguments, and returns their sum.
A main function which asks the user for two integer values, passes the two values to the sum function, then prints the two values and their sum.
The main function then again asks the user for two integer values, passes the two values to the sum function, then prints the two values and their sum.

Test it once, with the values 3 and 4, and then 5 and 49.

### Problem G3

The purpose of this problem is to write some small functions and practice passing things around amoung functions.
1) The main function shall ask the user to enter three numbers and read the three numbers.
2) Write a function named `findSum` that takes three numbers as arguments and returns their sum. The main function shall call this function.
3) Write a function named `findAverage` that takes the sum and the number of numbers and returns the average. The main function shall call this function.
4) Write a function named `findSmallest` that takes the three numbers and returns the smallest value. The main function shall call this function.
5) The main function shall print the results in the following format, with two decimal positions and the decimal points aligned:

```Results:
First  number   17.23
Second number    3.98
Third  number   22.32
Total           43.53
Average         14.51
Smallest         3.98
```

Test the program twice with the following two sets of numbers:

```37.144  2.4144  19
4.23   5.78     6.21
```