Please help a noobie out! Loops :(
Hey people that are way smarter then me! :D
well i just started teaching myself c and I am going through the book "let us c" by Yashavant P. Kanetkar.
I'm on chapter three which is an introduction to loops and i'm running into a problem which is driving me crazy!
ok in this program, im trying to use the do-while loop to do a very simple thing.
Code:
#include <stdio.h>
int main()
{
char another;
do
{
printf("hi!\n");
printf("want me to say hi again? (y/n)\n");
scanf("%c", &another);
} while(another=='y');
printf("Done.\n");
return 0;
}
According to the book i should be able to keep entering "y" and it would keep looping indefinitely! But instead it just does it once...and that's it.
If anyone can please help me it would be greaatttllllly appreciated! haha I know I'm a beginner but even then, I would like to be able to add a basic y/n feature to my programs :(