Issue #2: Look at your condition - the while loop can only end when both parts are false, which means that choice has to be both 'f' and 'F' at the same time, which can never happen. You probably meant to use && instead of ||.
1) Only lines 32-36 are inside the loop. Following condition executed only once and operates on latest integer read.
2) It is bette to loop on input operation: while (inputfile >> integer)
3) Your choice variable is always either not F or not f (as it cannot be both at the same time), therefore condition is always true. Use && instead of || here.
Issue #1, take a look at the while loop on lines 31-36:
1 2 3 4 5 6
while (inputfile) // While I am reading the file
{
numberOfintegers++; // I am counting the number of integers
sumOfintegers = sumOfintegers + integer; // I am adding the integers as I loop.
inputfile >> integer; // I am inputing the next integer.
} // This bracket tells me to not execute additional duties besides the 3 above.
You should move the closing bracket from line 36 to line 48:
while (inputfile) // While I am reading the file
{
numberOfintegers++; // I am counting the number of integers
sumOfintegers = sumOfintegers + integer; // I am adding the integers as I loop.
inputfile >> integer; // I am inputing the next integer.
if (numberOfintegers > 0)
averageOfintegers = sumOfintegers / numberOfintegers;if (integer > largestValue)
largestValue = integer;
if (integer < smallestValue)
{
smallestValue = integer;
}
}// This bracket tells me to not execute additional duties besides the operations above.
if (numberOfintegers > 0)
averageOfintegers = sumOfintegers / numberOfintegers;
I hope it helps. Good luck!
Edited: MiiNiPaa brought up a good point about the average calculation