哈工大C语言程序设计精髓MOOC慕课 周编程题答案 联系客服

发布时间 : 星期二 文章哈工大C语言程序设计精髓MOOC慕课 周编程题答案更新完毕开始阅读bd270654846fb84ae45c3b3567ec102de2bddfc7

printf(\,please re-enter!\\n\

continue; } s -= n;

printf(\of matches left is:%d\\n\ if (s > 0) {

if (s==3) {

c = 2; }

else if (s==2){ c=1; }

else if (s==1){ c=1; } else {

c = s%3+1;

} s -= c;

printf(\the computer is:%d\\nThe number of matches left is:%d\\n\ if (s==0){

printf(\!You won!\\n\ break; } }

else if (s==0){

printf(\ } } }\

\

题目内容:请输入星期几的第一个字母(不区分大小写)来判断一下是星期几,如果第一个字母一样,则继续判断第二个字母(小写),否则输出“data error”。 程序运行结果示例1:

please input the first letter of someday: S↙

please input second letter: u↙

sunday

程序运行结果示例2:

please input the first letter of someday: F↙ friday

程序运行结果示例2:

please input the first letter of someday: h↙ data error

第一个字母的输入提示信息:\第二个字母的输入提示信息:\用户输入错误提示信息:\输入格式: \(注意:%c前面有一个空格) 输出格式:

星期一:\星期二:\星期三:\星期四:\星期五:\星期六:\星期日:\*/

#include<> main() { char i,j;

printf(\ scanf(\ switch(i) {

case 'm':case 'M':

printf(\ break; case 'w':case 'W':

printf(\ break; case 'f':case 'F':

printf(\ break; case 't':case 'T':

printf(\ scanf(\ j=getchar(); if (j=='u')

printf(\ else if (j=='h')

printf(\ else printf(\ break; case 's':case 'S':

printf(\ scanf(\ j=getchar(); if (j=='a')

printf(\ else if (j=='u')

printf(\ else printf(\ break;

default : printf(\ } }\