二级C语言上机考试复习资料
(共0套题目)第1套
1、程序填空题#includestdio.h
void fun(char *s, int *t)
{ int i, n;n=0;
/**********found**********/for(i=0; ___1___ !=0; i++)
/**********found**********/if(s[i]=0s[i]= ___2___ ) n++;
/**********found**********/___3___ ;
}
main()
{ char s[80]=abcdef35adgh3kjsdf7;int t;printf(\nThe original string is : %s\n,s);fun(s,t);printf(\nThe result is : %d\n,t);
}
2、程序修改题
#include stdio.h
int fun(int *x,int y)
{
int t ;
/**************found**************/
t = x ; x = y ;
/**************found**************/
return(y) ;
}
main()
{
int a = 3, b = 8 ;printf(%d %d\n, a, b) ;
b = fun(a, b) ;
printf(%d %d\n, a, b) ;
}3、程序设计题
#include stdio.h
void fun (int *a, int *n)
{}
main( )
{ int aa[1000], n, k ;fun ( aa, n ) ;for ( k = 0 ; k n ; k++ )if((k + 1) % 10 == 0) printf(\n) ;else printf(%5d, aa[k]) ;
}
第2套
1、程序填空题#include stdio.h
void fun(char *s, char *p)
{ int i, j, n, x, t;n=0;for(i=0; s[i]!=\0; i++) n++;for(i=1; in-2; i=i+2) {
/**********found**********/___1___;
/**********found**********/for(j=___2___+2 ; jn; j=j+2)if(s[t]s[j]) t=j;if(t!=i){ x=s[i]; s[i]=s[t]; s[t]=x; }}for(i=1,j=0; in; i=i+2, j++) p[j]=s[i];
/**********found**********/p[j]=___3___;
}
main()
{ char s[80]=baawrskjghzlicda, p[50];printf(\nThe original string is : %s\n,s);fun(s,p);printf(\nThe result is : %s\n,p);
}2、程序修改题
#include math.h
#include stdio.h
float fun ( float num )
{ int s ;float n, t, pi ;t = 1 ; pi = 0 ; n = 1 ; s = 1 ;
/**************found**************/while(t = num){pi = pi + t ;n = n + 2 ;s = -s ;
/**************found**************/t = s % n ;}pi = pi * 4 ;return pi ;
}
main( )
{ float n1, n2 ;printf(Enter a float number: ) ;scanf(%f, n1) ;n2 = fun(n1) ;printf(%6.4f\n, n2) ;
}3、程序设计题
#include stdio.h
#include string.h
#define LEN 20
void fun (char a[], char b[], int n)
{}
main( )
{ char str1[LEN], str2[LEN] ;int n ;printf(Enter the string:\n) ;gets(str1) ;printf(Enter the index of the char deleted:) ;scanf(
您可能关注的文档
最近下载
- (高清版)DB13∕T 5181-2020 尾矿库溃坝泥石流数值模拟技术规程.pdf VIP
- 2026北京资产管理有限公司业务总监招聘1人备考题库有答案详解.docx VIP
- ZHJZIV火焰检测系统用户手册[中文C版].doc VIP
- DB37_T 5249-2023城市园林绿化精细化养护管理标准.pdf VIP
- DataXone数据与大数据云交换平台白皮书.pdf VIP
- 超声肝脏弹性科普.pptx VIP
- 2026北京资产管理有限公司业务总监招聘1人备考题库及答案详解一套.docx VIP
- 日立电梯HE12控制系统故障处理资料.pdf
- 2024--2025学年福建省厦门市双十中学八年级下学期期中历史试题.doc VIP
- 员工激励机制研究 毕业论文.doc VIP
原创力文档

文档评论(0)