Working on the program you originally posted, your calculations are wrong because to compute the average and uncertainty you are using n. n is the index for the for loop. When the for loop exits, n will be one more than first (ie 1 more than the numbers summed). Instead of using n in the calculation, use first.
You are also reading the first value at the start of the program so this won't be added to the sum
in >> currentvalue;
min = currentvalue;
max = currentvalue;
Usual practice is to set min to be greater than the max value and max to be less than the min value. Or by using the predefined constants in limits.h and float.h you could set