I have put a comment in my code. Please answer this in as much detail as you can. This question has been bugging me. I wish he said the answer in his video.
Code:
#include <stdio.h>
main()
{
char type;
int album; /* boolean */
while (type != 'a' && type != 's')
{
printf("Album or single (a for album, s for single)? ");
fflush(stdin);
scanf("%c", &type);
album = type == 'a';
if (type != 'a' && type != 's') /* How come this has to be an and condition? Why wont the or condition work? */
printf("Error\n");
}
if (album)
printf("Album\n");
else
printf("Single\n");
fflush(stdin);
getchar();
}
Thank you very much for any help you can give.