Originally Posted by
kbikkasani
Thanks for the tips. The problem is that GetInteger occurs when running the function unnecessarily at one point right after running the program. I believe it is a problem with the while statement but when i do
while (n!=0)
It fixes the first error but I get the minimum = 0 although that is just supposed to be the sentinel,
i will try to post in the c+ forums for help. Thanks again for the advice
The problem is that you are calling GetInteger twice the first time.
printf("Enter first number: ");
n=
GetInteger();
{
min=n;
max=n;
while ((
n=GetInteger())!=0)
{
You can fix this by removing the first getInteger altogether, as the while loop will not enter if you enter 0. But, you must first initialize n to 0 as your setting min and max to 0. Also, the curly brace after the first getInteger is not required.
Code:
int n= 0;
printf("Enter first number: ");
min=n;
max=n;
while ((n=GetInteger())!=0)
{