I have 6 options in my code and it does create a binary file in my project folder when I press 4 but when I press 5 it doesn't work.
printf("1. Add a car to the fleet.\n");
printf("2. Delete last car from the fleet.\n");
printf("3. Display full fleet on the screen.\n");
printf("4. Save...
My program on Pelles C is creating a binary file when I want the results to save to a file but I'm not sure on how to open the binary file in cmd in Pelles C so that it is readable and I can read it.
I'm just curious why this code will work because it was part of a larger code and x was used as a check. When we got the desired result, x=1, wouldn't "!x" repeat the loop when we don't want it to repeat so to exit the loop?
I don't understand why this would work, shouldn't it be "while(x)" because we don't want to repeat the loop?
int main(void)
{
int x=0;
do {
printf("Enter an amount:\n");
scanf("%lf", &amount);
if (amount < 100)
x=1;
else
printf("Invalid");
}while(!x);
return 0;
}