成都信息工程学院C语言考试题及答案 联系客服

发布时间 : 星期六 文章成都信息工程学院C语言考试题及答案更新完毕开始阅读7ea6d655312b3169a451a47e

}

}

}

return 0;

printf(\data1, op, data2, result); return 0;

编写一程序P702.C实现以下功能

输入月份,打印2003年该月有几天。当输入的月份超范围时,应显示“Invalid month input”。编程可用素材:printf(\、printf(\、printf(\。 程序的运行效果应类似地如图1和图2所示,图1中的4和图2中的13是从键盘输入的内容。 #include

int main(void) {

switch (month) {

case 1: case 3: case 5: case 7: case 8: case 10: case 12:

day = 31; break;

printf(\input the month number: \scanf(\&month); int month, day;

case 4:

}

}

case 6: case 9: case 11:

day = 30; break; day = 28; break; day = -1;

case 2:

default :

if (-1 == day) { } else { } return 0;

printf(\2003.%d has %d days\\n\month, day); printf(\month input !\\n\

编写一程序P703.C实现以下功能

已知某公司员工的保底薪水为500,某月所接工程的利润profit(整数)与利润提成的关系如下(计量单位:元):

profit≤1000 没有提成; 1000<profit≤2000 提成10%; 2000<profit≤5000 提成15%; 5000<profit≤10000 提成20%; 10000<profit 提成25%。

请根据输入的利润计算员工的薪水。编程可用素材:printf(\t: \、printf(\。

程序的运行效果应类似地如图1所示,图1中的2000是从键盘输入的内容。

#include

int main(void) {

int profit, grade; double salary = 500;

printf(\ profit: \scanf(\&profit);

grade = (profit - 1) / 1000; switch (grade) { }

case 0:

break;

salary += profit * 0.1; break; case 1:

case 2: case 3: case 4:

salary += profit * 0.15; break;

case 5: case 6: case 7: case 8: case 9:

salary += profit * 0.2; break;

salary += profit * 0.25;

default:

}

printf(\salary); return 0;

编写一程序P708.C实现以下功能

输入一个三位正整数,然后逆序输出。如输入123,则输出321。编程可用素材:printf(\、printf(\。

程序的运行效果应类似地如图1所示,图1中的750是从键盘输入的内容。 #include

int main(void) { }

编写一程序P709.C实现以下功能

输入一个华氏温度,要求输出摄氏温度,计算公式为c=5(F-32)/9。编程可用素材:printf(\、printf(\。

程序的运行效果应类似地如图1所示,图1中的120是从键盘输入的内容。 #include

int main(void) {

/* 从键盘上读入华氏温度到变量fF中 */

float fC, fF=1.0; //fC存放摄氏温度的值,fF存放华氏温度的值 return 0; bai = num / 100; shi = num % 100 / 10; ge = num % 10;

printf(\result is %d%d%d\\n\ge, shi, bai); int num, bai, shi, ge;

printf(\an integer: \scanf(\&num);