ImageVerifierCode 换一换
格式:DOCX , 页数:31 ,大小:20.26KB ,
资源ID:25685228      下载积分:3 金币
快捷下载
登录下载
邮箱/手机:
温馨提示:
快捷下载时,用户名和密码都是您填写的邮箱或者手机号,方便查询和重复下载(系统自动生成)。 如填写123,账号就是123,密码也是123。
特别说明:
请自助下载,系统不会自动发送文件的哦; 如果您已付费,想二次下载,请登录后访问:我的下载记录
支付方式: 支付宝    微信支付   
验证码:   换一换

加入VIP,免费下载
 

温馨提示:由于个人手机设置不同,如果发现不能下载,请复制以下地址【https://www.bdocx.com/down/25685228.html】到电脑端继续下载(重复下载不扣费)。

已注册用户请登录:
账号:
密码:
验证码:   换一换
  忘记密码?
三方登录: 微信登录   QQ登录  

下载须知

1: 本站所有资源如无特殊说明,都需要本地电脑安装OFFICE2007和PDF阅读器。
2: 试题试卷类文档,如果标题没有明确说明有答案则都视为没有答案,请知晓。
3: 文件的所有权益归上传用户所有。
4. 未经权益所有人同意不得将文件中的内容挪作商业或盈利用途。
5. 本站仅提供交流平台,并不能对任何下载内容负责。
6. 下载文件中如有侵权或不适当内容,请与我们联系,我们立即纠正。
7. 本站不保证下载资源的准确性、安全性和完整性, 同时也不承担用户因使用这些下载资源对自己和他人造成任何形式的伤害或损失。

版权提示 | 免责声明

本文(全国计算机C语言二级上机试题10套8190.docx)为本站会员(b****9)主动上传,冰豆网仅提供信息存储空间,仅对用户上传内容的表现方式做保护处理,对上载内容本身不做任何修改或编辑。 若此文所含内容侵犯了您的版权或隐私,请立即通知冰豆网(发送邮件至service@bdocx.com或直接QQ联系客服),我们立即给予删除!

全国计算机C语言二级上机试题10套8190.docx

1、全国计算机C语言二级上机试题10套819081#include fun(int x) int n, s1, s2, s3, t;/*found*/ n=_1_; t=100;/*found*/ while(t999|x0) printf(Please input(0x=999): ); scanf(%d,&x); printf(nThe result is: %dn,fun(x);0000000000000000000#include #include void fun (char *s, char *t)/*found*/ int i; sl = strlen(s); for (i=0; i

2、sl; i+)/*found*/ ti = ssl-i; for (i=0; isl; i+) tsl+i = si; t2*sl = 0;main() char s100, t100; printf(nPlease enter string s:); scanf(%s, s); fun(s, t); printf(The result is: %sn, t);000000000000000000#include void fun(int a, int b, long *c)NONO ( )/* 本函数用于打开文件,输入数据,调用函数,输出数据,关闭文件。 */ FILE *rf, *wf ;

3、 int i, a,b ; long c ; rf = fopen(C:WEXAMYS240001in.dat,r) ; wf = fopen(C:WEXAMYS240001out.dat,w) ; for(i = 0 ; i 10 ; i+) fscanf(rf, %d,%d, &a, &b) ; fun(a, b, &c) ; fprintf(wf, a=%d,b=%d,c=%ldn, a, b, c) ; fclose(rf) ; fclose(wf) ;main() /* 主函数 */ int a,b; long c; printf(Input a, b:); scanf(%d%d,

4、&a, &b); fun(a, b, &c); printf(The result is: %ldn, c); NONO();82#include #include #define N 8typedef struct list int data; struct list *next; SLIST;void fun( SLIST *h, int x) SLIST *p, *q, *s; s=(SLIST *)malloc(sizeof(SLIST);/*found*/ s-data=_1_; q=h; p=h-next; while(p!=NULL & xp-data) /*found*/ q=

5、_2_; p=p-next; s-next=p;/*found*/ q-next=_3_;SLIST *creatlist(int *a) SLIST *h,*p,*q; int i; h=p=(SLIST *)malloc(sizeof(SLIST); for(i=0; idata=ai; p-next=q; p=q; p-next=0; return h;void outlist(SLIST *h) SLIST *p; p=h-next; if (p=NULL) printf(nThe list is NULL!n); else printf(nHead); do printf(-%d,p

6、-data); p=p-next; while(p!=NULL); printf(-Endn); main() SLIST *head; int x; int aN=11,12,15,18,19,22,25,29; head=creatlist(a); printf(nThe list before inserting:n); outlist(head); printf(nEnter a number : ); scanf(%d,&x); fun(head,x); printf(nThe list after inserting:n); outlist(head);00000000000000

7、000000000#include long fun (long num)/*found*/ long k; do k*=num%10 ;/*found*/ num=10 ; while(num) ; return (k) ;main( ) long n ; printf(nPlease enter a number:) ; scanf(%ld,&n) ; printf(n%ldn,fun(n) ;00000000000000000000#include float fun ( float *a , int n )NONO ( )/* 本函数用于打开文件,输入数据,调用函数,输出数据,关闭文件

8、。 */ FILE *fp, *wf ; int i, j ; float aver, score5 ; fp = fopen(C:WEXAMYS240001in.dat,r) ; wf = fopen(C:WEXAMYS240001out.dat,w) ; for(i = 0 ; i 10 ; i+) for(j = 0 ; j 5 ; j+) fscanf(fp,%f,&scorej) ; aver = fun(score, 5) ; fprintf(wf, %5.2fn, aver) ; fclose(fp) ; fclose(wf) ;main() float score30=90.5

9、, 72, 80, 61.5, 55, aver; aver = fun( score, 5 ); printf( nAverage score is: %5.2fn, aver); NONO ( );83#include #include #define N 5#define M 8int fun(char (*ss)M,char *t) int i;/*found*/ for(i=0; i _1_ ; i+)/*found*/ if(strcmp(ssi,t)=0 ) return _2_ ; return -1;main() char chNM=if,while,switch,int,f

10、or,tM; int n,i; printf(nThe original stringnn); for(i=0;iN;i+)puts(chi); printf(n); printf(nEnter a string for search: ); gets(t); n=fun(ch,t);/*found*/ if(n= _3_) printf(nDont found!n); else printf(nThe position is %d .n,n);00000000000000000000#include fun( int *b ) int k,a1,a2,i=0; for(k=10; k=55;

11、 k+) /*found*/ a2=k/1O; a1=k-a2*10; if(k%3=0 & a2=5)|(k%3=0 & a1=5) bi=k; i+; /*found*/ return k; main( ) int a100,k,m; m=fun( a ); printf(The result is :n); for(k=0; km; k+) printf(%4d,ak); printf(n);00000000000000000000000000#include void fun( char *a )NONO()/* 本函数用于打开文件,输入数据,调用函数,输出数据,关闭文件。 */ FI

12、LE *in, *out ; int i ; char s81 ; in = fopen(C:WEXAMYS240001in.dat,r) ; out = fopen(C:WEXAMYS240001out.dat,w) ; for(i = 0 ; i 10 ; i+) fscanf(in, %s, s) ; fun(s) ; fprintf(out, %sn, s) ; fclose(in) ; fclose(out) ;main() char s81; printf(Enter a string:n);gets(s); fun( s ); printf(The string after de

13、leted:n);puts(s); NONO();84#include #include #include void WriteText(FILE *);void ReadText(FILE *);main() FILE *fp; if(fp=fopen(myfile4.txt,w)=NULL) printf( open fail!n); exit(0); WriteText(fp); fclose(fp); if(fp=fopen(myfile4.txt,r)=NULL) printf( open fail!n); exit(0); ReadText(fp); fclose(fp);/*fo

14、und*/void WriteText(FILE _1_) char str81; printf(nEnter string with -1 to end :n); gets(str); while(strcmp(str,-1)!=0) /*found*/ fputs(_2_,fw); fputs(n,fw); gets(str); void ReadText(FILE *fr) char str81; printf(nRead file and output to screen :n); fgets(str,81,fr); while( !feof(fr) ) /*found*/ print

15、f(%s,_3_); fgets(str,81,fr); 0000000000000000000000#include /*found*/void fun (long s, long t) long sl=10; *t = s % 10; while ( s 0) s = s/100; *t = s%10 * sl + *t;/*found*/ sl = sl*100; main() long s, t; printf(nPlease enter s:); scanf(%ld, &s); fun(s, &t); printf(The result is: %ldn, t);0000000000

16、00000000000#include void fun(int a, int b, long *c)NONO ( )/* 本函数用于打开文件,输入数据,调用函数,输出数据,关闭文件。 */ FILE *rf, *wf ; int i, a,b ; long c ; rf = fopen(C:WEXAMYS240001in.dat, r) ; wf = fopen(C:WEXAMYS240001out.dat,w) ; for(i = 0 ; i 10 ; i+) fscanf(rf, %d,%d, &a, &b) ; fun(a, b, &c) ; fprintf(wf, a=%d,b=%d

17、,c=%ldn, a, b, c) ; fclose(rf) ; fclose(wf) ;main() int a,b; long c; printf(Input a, b:); scanf(%d,%d, &a, &b); fun(a, b, &c); printf(The result is: %ldn, c); NONO();85#include /*found*/_1_ fun(char ch)/*found*/ if (ch=0 & _2_)/*found*/ return 9- (ch-_3_); return ch ;main() char c1, c2; printf(nThe

18、result :n); c1=2; c2 = fun(c1); printf(c1=%c c2=%cn, c1, c2); c1=8; c2 = fun(c1); printf(c1=%c c2=%cn, c1, c2); c1=a; c2 = fun(c1); printf(c1=%c c2=%cn, c1, c2);00000000000000000#include void fun(char *p, char *b) int i, k=0; while(*p) i=1; while( i=3 & *p ) /*found*/ bk=p; k+; p+; i+; if(*p) /*foun

19、d*/ bk+= ; bk=0;main() char a80,b80; printf(Enter a string: ); gets(a); printf(The original string: ); puts(a); fun(a,b); printf(nThe string after insert space: ); puts(b); printf(nn);0000000000000000#include #include #define N 8struct slist double s; struct slist *next;typedef struct slist STREC;do

20、uble fun( STREC *h )STREC * creat( double *s) STREC *h,*p,*q; int i=0; h=p=(STREC*)malloc(sizeof(STREC);p-s=0; while(is=si; i+; p-next=q; p=q; p-next=0; return h;outlist( STREC *h) STREC *p; p=h-next; printf(head); do printf(-%4.1f,p-s);p=p-next; while(p!=0); printf(nn);NONO()/* 本函数用于打开文件,输入数据,调用函数,

21、输出数据,关闭文件。 */ FILE *in, *out ; int i,j ; double sN,ave; STREC *h ; in = fopen(C:WEXAMYS240001in.dat,r) ; out = fopen(C:WEXAMYS240001out.dat,w) ; for(i = 0 ; i 10 ; i+) for(j=0 ; j N; j+) fscanf(in, %lf, &sj) ; h=creat( s ); ave=fun( h ); fprintf(out, %6.3lfn, ave) ; fclose(in) ; fclose(out) ;main()

22、double sN=85,76,69,85,91,72,64,87,ave; STREC *h; h=creat( s ); outlist(h); ave=fun( h ); printf(ave= %6.3fn,ave); NONO();86#include double fun(double x, int n) double f, t; int i; f = 1.0;/*found*/ t = _1_;/*found*/ for (i=_2_; in; i+) /*found*/ t *= x/_3_; f += t; return f;main() double x, y; x=2.5

23、; y = fun(x, 12); printf(nThe result is :n); printf(x=%-12.6f y=%-12.6fn, x, y);00000000000000000000000000#include #define N 100int fun(int *s, int n) int i,j,k,a,b,c; j=0; for(i=100; in; i+) /*found*/ k=n; a=k%10; k/=10; b=k%10; k/=10;/*found*/ c=k%10 if( a=b & a=c ) sj+=i; return j;main() int aN, n, num=0, i; do printf(nEnter n( 1000); num = fun( a,n ); printf(nnThe result :n); for(i=0; inum; i+)printf(%5d,ai); printf(nn);00000000000000000000000000#include #include double fun(double x10)NONO()/* 请在此函数内打开文件,输入测试数据,调用 fun 函数,输出数据,关闭文件。 */ FILE *rf, *wf ; int

copyright@ 2008-2022 冰豆网网站版权所有

经营许可证编号:鄂ICP备2022015515号-1