版权说明:本文档由用户提供并上传,收益归属内容提供方,若内容存在侵权,请进行举报或认领
文档简介
1、全国计算机等级二级c语言上机编程题题型(National computer grade two, C language programming questions)First questionsImproving the function of the function of fun is: n personnel examination results of subsection statistics, scores on the a array, the number of the fraction of the deposit to the B array: the results fo
2、r the number of 60 to 69 to b0, 70 to 79 of the number of results for the deposit to the b1, the number of results 80 to 89 of the deposit to the b2, the number of results for the 90 to 99 deposit to the b3, the number of results for the 100 deposit to the b4, the number of scores below 60 points ar
3、e stored in b5.The brand for example, when the data in the array is a:Which was 93, 85, 77, 68, 59, 43, 94, 75, 98.Which was after this call, the data stored in the B array should be:Which was 1, 2, 1, 3, 0, 2.Note: there is a file which was part of the PROG1.C source program.Do not change any conte
4、nt of the brand main function and other function, only fill a number of statements you write the braces in the function fun.Which was Prog1.cWhich was #includeWhich was #includeAPThe brand of void fun (int a, int b, int n)APAPAPAPAP (main)AP int i, a100=93, 85, 77, 68, 59, 43, 94, 75, 98, b6;AP (clr
5、scr);Which was fun (a, B, 9);The brand printf (the result is:);AP for (i=0; i6; i+) printf (%d, bi);The brand printf (n);AP (NONO);APAPAP (NONO)Which was /* the function used to open the file, call the function, input data, output data, close the file. * /The brand FILE *rf, *wf;The brand int a100,
6、b6, I, j;Which was RF = fopen (in1.dat, R);Which was WF = fopen (bc01.dat, W);Which was for (I = 0; I 10; i+) Which was for (J = 0; J 10; j+ fscanf (RF), %d, &aj);Which was fun (a, B, 9);Which was for (J = 0; J 6; j+) fprintf (WF,%d, bj);Which was fprintf (WF, n);APWhich was Fclose (RF);Which was Fc
7、lose (WF);APAPAP program reference answerThe brand of void fun (int a, int b, int n)APThe brand int i;AP (for i=0; i6 i+; bi = 0);AP for (i=0; I AP if (ai 60) b5+;The brand of else b(ai- 60) /10+;APThe second questionImproving the function of the fun function is: the number of statistics of all ages
8、 to coexist in the B array, n personnels age on a array. The age of 1 to 9 of the number of deposited in the b0 age, the number of 10 to 19 of the deposit to the b1, the age of 20 the number to 29 to b2, the age of 30 to 39 of the number of deposit to the b3, the age of 40 to 49 the number of the de
9、posit to the b4, the number of age over the age of 50. To b5.The brand for example, when the a array data:Which was 9, 18, 27, 38, 59, 33, 14, 75, 38.Which was after this call, the data stored in the B array should be:Which was 1, 2, 1, 3, 0, 2.Note: there is a file which was part of the PROG1.C sou
10、rce program.Do not change any content of the brand main function and other function, only fill a number of statements you write the braces in the function fun.Which was #includeWhich was #includeAPThe brand of void fun (int a, int b, int n)APAPAPAPAP (main)AP int i, a100=9, 18, 27, 38, 59, 33, 14, 7
11、5, 38, b6;AP (clrscr);Which was fun (a, B, 9);The brand printf (The result is:);AP for (i=0; i6; i+) printf (%d, bi);The brand printf (n);AP (NONO);APAPAP (NONO)Which was /* the function used to open the file, call the function, input data, output data, close the file. * /The brand FILE *rf, *wf;The
12、 brand int a100, b6, I, j;Which was RF = fopen (in2.dat, R);Which was WF = fopen (bc02.dat, W);Which was for (I = 0; I 10; i+) Which was for (J = 0; J 10; j+ fscanf (RF), %d, &aj);Which was fun (a, B, 9);Which was for (J = 0; J 6; j+) fprintf (WF,%d, bj);Which was fprintf (WF, n);APWhich was Fclose
13、(RF);Which was Fclose (WF);APAP program reference answerThe brand of void fun (int a, int b, int n)APThe brand int i;AP (for i=0; i = 50 b5+);The brand else bai/10+;APThe third questionImproving the function of the fun function is: Statistics in the string a, the number of characters specified below
14、, the coexistence of the B array, including: the number of characters + appears to b0, the number of characters - the deposit to the b1, the number of characters * to the b2 character / the number of deposit to the b3, the number of characters & the deposit to the b4, the number of other characters
15、appear are stored in b5.The brand for example, when the string in the a string: -+*1-a/&b,Which was after this call, the data stored in B should be: 1, 2, 1, 2, 1, 3.Note: there is a file which was part of the PROG1.C source program.Do not change any content of the brand main function and other func
16、tion, only fill a number of statements you write the braces in the function fun.APWhich was #includeWhich was #includeWhich was #includeAPThe brand of void fun (char *a, int b)APAPAPAPAP (main)AP int i, b6; char a100 = -+*1/-a/&b;AP (clrscr);Which was fun (a, B);The brand printf (The result is:);AP
17、for (i=0; i6; i+) printf (%d, bi);The brand printf (n);AP (NONO);APAPAP (NONO)Which was /* the function used to open the file, call the function, input data, output data, close the file. * /The brand FILE *rf, *wf;The brand char a100, *p;The brand int b6, I, j;Which was RF = fopen (in6.dat, R);Which
18、 was WF = fopen (bc06.dat, W);Which was for (I = 0; I 10; i+) Which was fgets (a, 99, RF);Which was p = strchr (a, n);Which was if (P) *p = 0;Which was fun (a, B);Which was for (J = 0; J 6; j+) fprintf (WF,%d, bj);Which was fprintf (WF, n);APWhich was Fclose (RF);Which was Fclose (WF);APAPAP program
19、 reference answerThe brand of void fun (char *a, int b)APThe brand int i;AP (for i=0; i6 i+; bi = 0);AP (for i=0; i strlen; i+ (a)Which was switch (ai)Which was the + case: b0+; break;The brand case -: b1+; break;The brand case *: b2+; break;The brand case: break / b3+;The brand case &: b4+; break;T
20、he brand default: b5+;APAPFourth questionsImproving the function of the function of fun is to reverse n in the a array and B array of n Shuyiyi corresponding results are added in the C array.For example: when the a of the brand value in the array is: 1, 3, 5, 7, 8Improving the b values in the array
21、are: 2, 3, 4, 5, 8Which was after this call, 9, 8, 9, 10, 10 is the data stored in the C arrayNote: there is a file which was part of the PROG1.C source program.Do not change any content of the brand main function and other function, only fill a number of statements you write the braces in the funct
22、ion fun.APWhich was #includeWhich was #includeAPThe brand of void fun (int a, int b, int c, int n)APAPAPAPAP (main)The brand a100=1,3,5,7,8, I int, b100=2,3,4,5,8, c100;AP (clrscr);Which was fun (a, B, C, 5);The brand printf (The result is:);AP for (i=0; i5; i+) printf (%d, ci);The brand printf (n);
23、AP (NONO);APAPAP (NONO)Which was /* the function used to open the file, call the function, input data, output data, close the file. * /The brand FILE *rf, *wf;The brand int a100, b100, c100, I, j;Which was RF = fopen (in.dat, R);Which was WF = fopen (bc01.dat, W);Which was for (I = 0; I 5; i+) 为(J = 0;J5;j+)fscanf(RF,“%d”,和一个 J );为(J = 0;J5;j+)fscanf(RF,“%d”,与B J );(A,B,C的乐趣,5);为(J = 0;J5;j+)fprintf(WF,“%d”,C J );fprintf(WF,“n”);fclose(RF);fclose
温馨提示
- 1. 本站所有资源如无特殊说明,都需要本地电脑安装OFFICE2007和PDF阅读器。图纸软件为CAD,CAXA,PROE,UG,SolidWorks等.压缩文件请下载最新的WinRAR软件解压。
- 2. 本站的文档不包含任何第三方提供的附件图纸等,如果需要附件,请联系上传者。文件的所有权益归上传用户所有。
- 3. 本站RAR压缩包中若带图纸,网页内容里面会有图纸预览,若没有图纸预览就没有图纸。
- 4. 未经权益所有人同意不得将文件中的内容挪作商业或盈利用途。
- 5. 人人文库网仅提供信息存储空间,仅对用户上传内容的表现方式做保护处理,对用户上传分享的文档内容本身不做任何修改或编辑,并不能对任何下载内容负责。
- 6. 下载文件中如有侵权或不适当内容,请与我们联系,我们立即纠正。
- 7. 本站不保证下载资源的准确性、安全性和完整性, 同时也不承担用户因使用这些下载资源对自己和他人造成任何形式的伤害或损失。
最新文档
- 三年级下册音乐教案第4课 歌曲《瑶山乐》花城版
- 【大单元】18《太空生活趣事多》第一课时 教学设计
- 2024商场地产中秋节游园市集系列(月亮捕捉计划主题)活动策划方案-58P
- 粤教版(2013)信息技术第二册 3.2机器人直行和旋转 教案
- 装饰工程投标书
- 毕业纪念册的赠言(30篇)
- 2024学生交通安全教育活动总结(33篇)
- 机动车驾驶培训教练员考试题库
- DB34∕T 4196-2022 饲料生产环节防控非洲猪瘟技术规范
- 《血清中米酵菌酸的测定 超高效液相色谱串联质谱法(征求意见稿)》编制说明
- 2021-2022学年统编版道德与法治五年级上册全册单元测试题及答案(每单元1套共6套)
- 2024年山东济南市历下区退役军人专职联络员招聘9人历年(高频重点复习提升训练)共500题附带答案详解
- 人教部编版三年级道德与法治上册全册教案(全册)
- 建筑与市政施工现场安全卫生与职业健康通用规范培训课件
- 胃肠功能不良人群治未病干预方案
- 少数民族传统体育运动会选拔赛方案
- module 3 the violence of nature教案
- 税务管理专业 我国高新技术企业税务风险管理研究——以华为技术有限公司为例
- 输血不良反应报告单.doc
- 最新《西游记》知识竞赛题(附答案)教师卷
- 六根B型孔明锁
评论
0/150
提交评论