Not bad; but you call this function
Code:
double getchoice(double ch)
{
printf("Please enter your code:");
scanf("%lf%*c", &ch);
return (ch);
}
like this:
I think you should either get rid of the parameter, return the value, and same the result (don't discard the return value); or pass the variable as a pointer.
Also, this line doesn't do anything:
(And sale is uninitialized because the call to getsales() doesn't modify it; also, it is the wrong type for getsales().)
You only need to prototype main() for really old, non-standard compilers.
I suggest you turn on warnings. Add these options to GCC:
Code:
-W -Wall -ansi -pedantic