while语句中的break问题
#include <stdio.h>
int main()
{
#define TRUE 1
int month;
while (TRUE)
{
printf("\nEnter a month between 1 and 12: ");
scanf("%d", &month);
if (month > 1 && month < 12)
break;
printf("Error - the month you entered is not valid.\n");
}
printf("The month accepted is %d\n", month);
return 0;
}
=======================
想问一下,这里的break中断以后,不是直接挑出while语句吗,怎么还会继续执行后面的printf提示error语句?如果我把break语句去掉,输入0或1则显示颠倒,而且程序永远不停止了。为什么?