Project 17

Passing arrays to functions & isdigit (100 points)


num[0] = 3  num[1] = 4  num[2] = 5  num[3] = 6.345  num[4] = 3.256

*ave = round_hundredths( sum / ( c + 1) )

*ave is the parameter in the function holding the average, round_hundredths is the user defined function, sum is the sum of the floats, and c + 1 is how many floats being averaged.

 

 
 
 
 
 
 
 
Sample output 1
 
Enter number 1 or a letter to quit: 3
Enter number 2 or a letter to quit: 4
Enter number 3 or a letter to quit: 5
Enter number 4 or a letter to quit: 6.345
Enter number 5 or a letter to quit: 3.256
Enter number 6 or a letter to quit: e
( 3.256 + 6.345 + 5 + 4 + 3 ) / 5 = 4.32
 
Sample output 2
 
Enter number 1 or a letter to quit: 5.5
Enter number 2 or a letter to quit: 8.4
Enter number 3 or a letter to quit: 8.596
Enter number 4 or a letter to quit: q
( 8.596 + 8.4 + 5.5 ) / 3 = 7.5
 
Sample output 3
 
Enter number 1 or a letter to quit: 45.6
Enter number 2 or a letter to quit: 6.356
Enter number 3 or a letter to quit: k
( 6.356 + 45.6 ) / 2 = 25.98
 
Sample output 4
 
Enter number 1 or a letter to quit: 5
Enter number 2 or a letter to quit: 9
Enter number 3 or a letter to quit: 2
Enter number 4 or a letter to quit: 4
Enter number 5 or a letter to quit: 6
Enter number 6 or a letter to quit: 3
Enter number 7 or a letter to quit: m
( 3 + 6 + 4 + 2 + 9 + 5 ) / 6 = 4.83