My professor asked me to write a program of calculating average using class.
A class must have four function,naming "avg2,avg6,avg8,avg10.
now user wants option to select which functions he wants to run.For Example, if user select "avg2" the functions runs in which user can enter only 2 numbers and function returns the average value, if user try to enter more than 2 numbers in "avg2" function than he'll get error.
while user input //¿how do you determine this?
if counter > limit
error 'Too many numbers'
value.at(counter) := input //¿do you know about arrays?
//computing the sum
sum := 0
for x in value
sum := sum + x
//computing the mean
avg <- sum/counter