[计算机类试卷]国家二级(C语言)机试模拟试卷197及答案与解析.doc

上传人:brainfellow396 文档编号:502940 上传时间:2018-11-29 格式:DOC 页数:5 大小:33KB
下载 相关 举报
[计算机类试卷]国家二级(C语言)机试模拟试卷197及答案与解析.doc_第1页
第1页 / 共5页
[计算机类试卷]国家二级(C语言)机试模拟试卷197及答案与解析.doc_第2页
第2页 / 共5页
[计算机类试卷]国家二级(C语言)机试模拟试卷197及答案与解析.doc_第3页
第3页 / 共5页
[计算机类试卷]国家二级(C语言)机试模拟试卷197及答案与解析.doc_第4页
第4页 / 共5页
[计算机类试卷]国家二级(C语言)机试模拟试卷197及答案与解析.doc_第5页
第5页 / 共5页
亲,该文档总共5页,全部预览完了,如果喜欢就下载吧!
资源描述

1、国家二级( C语言)机试模拟试卷 197及答案与解析 一、程序填空题( 30分) 1 给定程序中,函数 fun的功能是:判定形参 a所指的 NN(规定 N为奇数 )的矩阵是否是 “幻方 ”,若是,函数返回值为 1: 不是,函数返回值为 0。 “幻方 ”的判定条件是:矩阵每行、每列、主对角线及反对角线上元素之和都相等。 例如,以下33的矩阵就是一个 “幻方 ”: 请在程序的下划线处填入正确的内容并把下划线删除,使程序得出正确的结果。 注意:源程序存放在考生文件夹下的BLANKl C中。 不得增行或删行,也不得更改程序的结构 !#include#define N 3int fun(int(*a)N

2、) int i, j, m1, m2, row, colum; m1=m2=0 ; for(i=0; i 二、程序修改题( 30分) 2 给定程序 MODll C中函数 fun的功能是:计算 n的 5次方的值 (规定 n的值大于2、小于 8),通过形参指针传回主函数;并计算该值的个位、十位、百位上数字之和作为函数值返回。 例如, 7的 5次方是 16807,其低 3位数的和值是 15。 请改正函数 fun中指定部位的错误,使它能得出正确的结果。 注意:不要改动 main函数,不得增行或删行,也不得更改程序的结构 ! #include #include int fun(int n, int*value) int d, s, i; *found* d=0; s=0; for(i=1; i=8); sum=fun(n, double ave=0.0; *n=0; for(i=0; iN; i+)ave=ave+ai.s; ave /=N; /* 计算平均值 */ for(i=0; iN; i+) if(ai.save) /* 把低于平均值的记录存放到 b所指的数组中 */ b*n=ai; (*n)+; /* 人数加 1 */ 【试题解析】 ( 1)首先,通过循环求总分,然后求得平均分。 ( 2)在循环中,进行平均分与每个成绩进行比较,并将满足条件的数据存入数组及对其进行累加。

展开阅读全文
相关资源
猜你喜欢
  • ASD-STAN PREN 2078-1997 Aerospace Series Metallic Materials Manufacturing Schedule Inspection Schedule Inspection and Test Report Definition General Principles Preparation and Appr.pdf ASD-STAN PREN 2078-1997 Aerospace Series Metallic Materials Manufacturing Schedule Inspection Schedule Inspection and Test Report Definition General Principles Preparation and Appr.pdf
  • ASD-STAN PREN 2079-1986 Aerospace Series Bearings Precision Ball in Corrosion Resisting Steel for Instruments and Equipments with Flange Dimensions and Loads (Issue P 1)《航空航天系列 仪表和.pdf ASD-STAN PREN 2079-1986 Aerospace Series Bearings Precision Ball in Corrosion Resisting Steel for Instruments and Equipments with Flange Dimensions and Loads (Issue P 1)《航空航天系列 仪表和.pdf
  • ASD-STAN PREN 2080-1985 Aerospace Series Flexible Wire Ropes for Aircraft Controls in Corrosion Resisting Steel - Construction - Dimensions - Loads (Edition 2)《航空航天系列 航空器控制用耐蚀钢制软钢丝.pdf ASD-STAN PREN 2080-1985 Aerospace Series Flexible Wire Ropes for Aircraft Controls in Corrosion Resisting Steel - Construction - Dimensions - Loads (Edition 2)《航空航天系列 航空器控制用耐蚀钢制软钢丝.pdf
  • ASD-STAN PREN 2081-1977 Non-Metallic Bodied Pulleys with Ball Bearings - for Control Cables Dimensions and Loads Aerospace Series (Edition 1)《航空航天系列 控制索用带滚珠轴承的主体为非金属材料的滑轮 尺寸和负荷 第.pdf ASD-STAN PREN 2081-1977 Non-Metallic Bodied Pulleys with Ball Bearings - for Control Cables Dimensions and Loads Aerospace Series (Edition 1)《航空航天系列 控制索用带滚珠轴承的主体为非金属材料的滑轮 尺寸和负荷 第.pdf
  • ASD-STAN PREN 2082-1-1986 Aerospace Series Aluminium Alloy Forging Stock and Forgings - Technical Specification - Part 1 - General Requirements (Edition 1)《航空航天系列 铝和铝合金锻坯和锻件的技术规范 第.pdf ASD-STAN PREN 2082-1-1986 Aerospace Series Aluminium Alloy Forging Stock and Forgings - Technical Specification - Part 1 - General Requirements (Edition 1)《航空航天系列 铝和铝合金锻坯和锻件的技术规范 第.pdf
  • ASD-STAN PREN 2082-2-1986 Aerospace Series Aluminium Alloy Forging Stock and Forgings - Technical Specification - Part 2 - Forging Stock (Edition 1)《航空航天系列 铝和铝合金锻坯和锻件的技术规范 第2部分 锻坯 .pdf ASD-STAN PREN 2082-2-1986 Aerospace Series Aluminium Alloy Forging Stock and Forgings - Technical Specification - Part 2 - Forging Stock (Edition 1)《航空航天系列 铝和铝合金锻坯和锻件的技术规范 第2部分 锻坯 .pdf
  • ASD-STAN PREN 2082-3-1986 Aerospace Series Aluminium Alloy Forging Stock and Forgings - Technical Specification - Part 3 - Pre- Production and Production Forgings (Edition 1)《航空航天系.pdf ASD-STAN PREN 2082-3-1986 Aerospace Series Aluminium Alloy Forging Stock and Forgings - Technical Specification - Part 3 - Pre- Production and Production Forgings (Edition 1)《航空航天系.pdf
  • ASD-STAN PREN 2083-2000 Aerospace Series Copper or Copper Alloy Conductors for Electrical Cables Product Standard (Edition P 3 Supersedes Edition 2 January 1999 Replaced by EN 2083.pdf ASD-STAN PREN 2083-2000 Aerospace Series Copper or Copper Alloy Conductors for Electrical Cables Product Standard (Edition P 3 Supersedes Edition 2 January 1999 Replaced by EN 2083.pdf
  • ASD-STAN PREN 2084-2013 Aerospace series Cables electrical general purpose with conductors in copper or copper alloy Technical specification (Edition P 2).pdf ASD-STAN PREN 2084-2013 Aerospace series Cables electrical general purpose with conductors in copper or copper alloy Technical specification (Edition P 2).pdf
  • 相关搜索

    当前位置:首页 > 考试资料 > 职业资格

    copyright@ 2008-2019 麦多课文库(www.mydoc123.com)网站版权所有
    备案/许可证编号:苏ICP备17064731号-1