ok thx i'll try that.. ok lol this is sad but i need help in something else.. i'm having problems printin the highest and least values in an array.. i have a piece of code i tried and here it is:
int i=0;
int hi=0;
int lo=9999;
fscanf(f,"%d",&itemid[i]);
while (!feof(f)&&itemid[i]!=0)
{
fscanf(f,"%f",&costprice[i]);
fscanf(f,"%f",&sprice[i]);
fscanf(f,"%d",&squantity[i]);
fscanf(f,"%d",&quantitysold[i]);
fscanf(f,"%d",&itemid[i]);
}
if (costprice[i]>hi){
hi=costprice[i];
}
if (costprice[i]<lo){
lo=costprice[i];
}
printf("%d is the highest cost price\n",hi);
printf("\n%d is the least cost price",lo);
getch();
}
It's printin out the highest value fine.. but it's not printin the correct value for the least.. can anybody tell me what's wrong please?
Thanks in advance