以下是引用TonyDeng在2015-12-6 14:02:46的发言:
搞明白了版本3、4的手法,你就知道菜单怎么写。
搞明白了版本3、4的手法,你就知道菜单怎么写。
太感谢了,这几个程序对我太有用了!

程序代码:
#include <stdio.h>
#include <stdlib.h>
int main()
{
int iDay= 0;
int flag = 0;
for(;!flag;)
{
printf("please input a number:\n");
#if _MSC_VER > 1200
if(scanf_s("%d",&iDay) !=1) fflush(stdin);
#else
if(scanf("%d",&iDay) !=1) fflush(stdin);
#endif
if(iDay>0 && iDay <8) flag = 1;
switch(iDay)
{
case 1:
case 2:
case 3:
case 4:
case 5:printf("Today to work hark\n");break;
case 6:printf("Today stay at home to sleep\n");break;
case 7:printf("Go shopping with friends\n");break;
default:
printf("Error\n");
}
}
return 0;
}
[此贴子已经被作者于2015-12-6 17:06编辑过]
