/* File : chrtest.c
By : Tep Dobry
Date :
*/
/* This file contains a short program to illustrate the problems of
mixing numeric and character input */
#include <stdio.h>
#define FLUSH while(getchar()!='\n');
/*
#define FIX_IT
*/
main()
{ int number;
char ch = 'y';
while(ch != 'n')
{ printf("enter a number: ");
scanf("%d", &number);
/* do something with it */
printf("number is %d\n",number);
#ifdef FIX_IT
FLUSH
#endif
printf("do you wish to continue(y/n): ");
ch = getchar();
}
printf("bye\n");
}