C语言 6.0

初学C语言,还望见谅;以前写过if语句,今天写if语句的嵌套;
int main()
{
int iDay;
int Monday=1,Tuesday=2,Wednesday=3,Turesday=4,Firday=5,
Saturday=6,Sunday=7;
printf("Enter a day of a week to get course\n");
scanf("%d",&iDay);

if(iDay>Firday)
{
if(iDay==Saturday)
{
printf("go shopping with friends\n");
}
else
{
printf("at home with families\n");
}
}
else
{
if(iDay==Monday)
{
printf("have a meeting with company\n");
}
else
{
printf("working with partner\n");
}
}
return 0;
}
这就是比较简单的嵌套,如有偏颇之处,还望见谅;

上一篇:PHP 判断给定两个时间是否在同一周,月,年


下一篇:Python3 迭代器深入解析