帮忙解释一下老师的例子(C语言)。

Squall

知名会员
注册
2003-04-01
消息
2,329
荣誉分数
11
声望点数
148
#define FLUSH while (getchar() != '\n')
{
char month[10];
printf("Please enter a month. ");
scanf("%9s",month);
/* Keep Reading till EOL */
FLUSH; /* Copy the Macro physically */
} /* Read Month */
 
#include <stdio.h> /*Read Second Int ; Reject rest*/
int main(void) {
int amount;
do {
printf("Enter <integer> <integer> <float>: ");
scanf("%*d%d%*[^\n]", &amount);
printf("Second Integer: %d\n",amount);
} while (amount >=0);
printf("\nThank You\n");
return 0;
} /* main */
 
后退
顶部