I had a couple of things while I was coding that I'm not sure about...
1. Which looks better, assuming that quit is an integer, either 0 or 1. Also, is there a different way to do it that would allow me to use something besides an int? (I know, I can have a char that is either 'y' or 'Y'. So is this better:
Code:
while (!quit)
{
/* stuff here, then ask quit/continue */
}
or this:
Code:
while (quit == 0)
{
/* stuff here, then ask quit/continue */
}
2. Another thing: I was trying to get a choice (integer value) between 1 and 4, otherwise scan again, using the code:
Code:
while ( !(choice==1 || choice ==2 || choice ==3 || choice ==4))
{
printf("Enter your choice: ");
scanf("%d", &choice);
}
... would this be the same as:
Code:
while (choice < 1 && choice > 4)
{
printf("Enter your choice: ");
scanf("%d", &choice);
}