云题海 - 专业文章范例文档资料分享平台

当前位置:首页 > 二级C语言2010年秋季考试(真题汇总)- 副本

二级C语言2010年秋季考试(真题汇总)- 副本

  • 62 次阅读
  • 3 次下载
  • 2026/4/27 15:06:43

计算机等级考试习题集

四、编程题部分

2.打开程序Cprog242.C,完成其中函数fun(int a[ ],int n),实现将一维数组a各元素在数组中循环右移n个位置。

例如:数组a各元素为:6 7 8 9 0

参数n=2时循环右移2个位置后数组各元素为:9 0 6 7 8

---------- Cprog241.C--------------------------------------------------------------------------------- #include #include #include double fun(double x) { /**/

/**/ }

void main() {

double x;

printf(\ scanf(\

printf(\ getch(); }

---------- Cprog242.C--------------------------------------------------------------------------------- #include #include #define COL 5

void fun(int a[],int n) {

/**/

-17-

计算机等级考试习题集

/**/ }

void main()

{ int arra[COL] = {6,7,8,9,0}; int i,j,n;

printf(\ for(i=0; i

printf(\ scanf(\ fun(arra,n);

printf(\ for(i=0; i

1.打开程序Cprog251.C,完成其中的fun函数,该函数的数学表达式是:

例如:f(2.53)=2.428

2.打开程序Cprog252.C,完成函数fun(int a[ ],int b[ ],float *f),实现如下功能:

1)将数组a中下标为奇数且元素值个位数字为3的所有元素依次存放到数组b中;2)将数组a中下标为偶数的所有元素平均值存放在指针参数f所指向的变量中。

---------- Cprog251.C--------------------------------------------------------------------------------- #include #include #include double fun(double x)

-18-

计算机等级考试习题集

{ /**/

/**/ }

void main() {

printf(\ getch(); }

---------- Cprog252.C--------------------------------------------------------------------------------- #include #include #define N 13

void fun(int a[],int b[],float *f) {

/**/ /**/ }

void main() {

int a[N] = {40,23,33,8,32,63,2,9,16,-3,3,0,13}; int b[N]={0}; int i; float aver; printf(\

-19-

计算机等级考试习题集

for(i=0;i

printf(\ \ printf(\ fun(a,b,&aver); printf(\ i=0;

while(b[i])

printf(\ \ printf(\

printf(\ getch(); }

1.打开程序Cprog261.C,完成其中的fun函数,该函数的数学表达式是:

2.打开程序Cprog262.C,完成函数long fun(int a[ ],int x,int d,int n),实现如下功能:1)以参数x为首项,d为公差,产生等差数列的n项,并依次存于数组a中; 2)函数返回值为所产生等差数列的n项和。

---------- Cprog261.C--------------------------------------------------------------------------------- #include #include #include double fun(float x) {

/**/

/**/ }

void main() { float x;

-20-

  • 收藏
  • 违规举报
  • 版权认领
下载文档10.00 元 加入VIP免费下载
推荐下载
本文作者:...

共分享92篇相关文档

文档简介:

计算机等级考试习题集 四、编程题部分 2.打开程序Cprog242.C,完成其中函数fun(int a[ ],int n),实现将一维数组a各元素在数组中循环右移n个位置。 例如:数组a各元素为:6 7 8 9 0 参数n=2时循环右移2个位置后数组各元素为:9 0 6 7 8 ---------- Cprog241.C--------------------------------------------------------------------------------- #include #include #include double fun(double x) { /**/ /**/ }

× 游客快捷下载通道(下载后可以自由复制和排版)
单篇付费下载
限时特价:10 元/份 原价:20元
VIP包月下载
特价:29 元/月 原价:99元
低至 0.3 元/份 每月下载150
全站内容免费自由复制
VIP包月下载
特价:29 元/月 原价:99元
低至 0.3 元/份 每月下载150
全站内容免费自由复制
注:下载文档有可能“只有目录或者内容不全”等情况,请下载之前注意辨别,如果您已付费且无法下载或内容有问题,请联系我们协助你处理。
微信:fanwen365 QQ:370150219
Copyright © 云题海 All Rights Reserved. 苏ICP备16052595号-3 网站地图 客服QQ:370150219 邮箱:370150219@qq.com