2016年真题解析 临时存答案 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 一、选择题 得18分 1.A 2.C 3.B 4.B(A) 5.A 6.D 7.B 8.A 9.D 10.B 二、判断题 得18分 错 对 错 对 错 错 错(对) 对 对 错 三、程序分析题 得30分 21. 主要功能:一个计算器,根据用户输入的符号来计算两个整数运算的结果。 输出数据: 12 + 120 = 132 60 / 3 =20 22. 主要功能:对用户输入的n个数字进行从小到大的冒泡排序 输出数据: OUTPUT:13 27 32 38 49 55 61 76 86 97 23. 主要功能:将用户输入的字符串中的小写字符变成大写字符 输出数据: Output:INTRODUCTION OF C++ LANGUAGE
四、程序设计题
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 #include <stdio.h> int main () { int score; char grade; printf ("请输入一个百分制整数:" ); scanf ("%d" , &score); if ((score < 0 ) && (score > 100 )) { printf ("\n请输入正确的数字!" ); return 0 ; } if (score >= 90 ) { grade = 'A' ; } if ((score >= 80 ) && (score <= 89 )) { grade = 'B' ; } if ((score >= 70 ) && (score <= 79 )) { grade = 'C' ; } if ((score >= 60 ) && (score <= 69 )) { grade = 'D' ; } if (score < 60 ) { grade = 'E' ; } printf ("\n等级为:%c" , grade); return 0 ; }
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 #include <stdio.h> #include <string.h> int main () { printf ("请输入一串字符:" ); char ar[200 ]; gets_s(ar); int len = strlen (ar); int j, i; i = 0 ; j = len - 1 ; while (j > i) { if (ar[i] == ar[j]) { i++; j--; } else { printf ("\nNO" ); return 0 ; } } printf ("\nYes" ); return 0 ; }
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 //26 #include <stdio.h> int main(){ printf("请输入数组的阶数和数组:"); int n; int ar[5][5]; scanf("%d",n); printf("\n"); for(int i =0 ;i<n;i++){ for(int j =0 ;j<n;j++){ scanf("%d",&ar[i][j]); } } int sum = 0; for(int i =0 ;i<n;i++){ sum += ar[i][i]; } printf("sum = %d",sum); }
题
不解析了好吧,146分,错的那两个是dinner题。