Im making a do while loop for C and the part I'm having trouble with looks like this
Code:
char y;
do
{
printf("On this machine the number of bytes in a char is : %d\n", sizeof(char));
printf("On this machine the number of bytes in a short is : %d\n", sizeof(short));
printf("On this machine the number of bytes in a int is : %d\n", sizeof(int));
printf("On this machine the number of bytes in a long is : %d\n", sizeof(long));
printf("On this machine the number of bytes in a float is : %d\n", sizeof(float));
printf("On this machine the number of bytes in a double is : %d\n", sizeof(double));
printf("On this machine the number of bytes in a pointer is : %d\n", sizeof(char));
printf("On this machine the number of bytes in a struct is : %d\n", sizeof(struct student));
printf("Would you like to see the information again?\n");
y = getchar();
}
while (scanf("%s",&y));
while (y == 'y');
while (y != EOF);
}
Well im new to this programming stuff, but im suppose to make a program that displays all those "On this machine" quotes everytime the user enters the letter "y". And if the user enters anything else, the program is suppose to print out : "Goodbye" and exit the program. The problem is that whenever i execute and enter "y", it prints out "on this machine", which is what I want. But i dont know how to get it to print "goodbye" and exit.
If anyone could help me, I will love you long time.