2 回答
TA贡献1880条经验 获得超4个赞
#include<stdio.h>
void main()
{
int a,b;
printf("输入今天是星期几:");
scanf("%d",&a);
for(;a<1||a>7;)
{
printf("输入错误,请输入1~7: ");
scanf("%d",&a);
}
b=((100%7)+a)%7;
switch(b)
{case 1: printf("100天后是星期一。\n");break;
case 2: printf("100天后是星期二。\n");break;
case 3: printf("100天后是星期三。\n");break;
case 4: printf("100天后是星期四。\n");break;
case 5: printf("100天后是星期五。\n");break;
case 6: printf("100天后是星期六。\n");break;
case 7: printf("100天后是星期日。\n");break;
}
}
TA贡献1806条经验 获得超5个赞
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML>
<HEAD>
<TITLE> New Document </TITLE>
<META NAME="Generator" CONTENT="EditPlus">
<META NAME="Author" CONTENT="">
<META NAME="Keywords" CONTENT="">
<META NAME="Description" CONTENT="">
</HEAD> <BODY>
<script type="text/javascript">
var D = new Date();
var sWeek = D.getDay();
var temp = "";
switch(sWeek)
{
case 0:
temp = "星期天";
break;
case 1:
temp = "星期一";
break;
case 2:
temp = "星期二";
break;
case 3:
temp = "星期三";
break;
case 4:
temp = "星期四";
break;
case 5:
temp = "星期五";
break;
case 6:
temp = "星期六";
break;
}
document.write(temp);
</script>
</BODY>
</HTML>
- 2 回答
- 0 关注
- 1390 浏览
添加回答
举报