Monday, November 1, 2010

getchar example-C

#include
void main()
{
  char answer;
   printf("would you like to continue\n");
  printf("type y for yes and n for no\n");
  answer=getchar();
  if(answer=='y' || answer=='Y')
  printf("you are proceeding further");
  else
  printf("you cancelled");
}

No comments:

Post a Comment