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

加入VIP,免费下载
 

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

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

下载须知

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

版权提示 | 免责声明

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

1正确地上机50套题目 2.docx

1、1正确地上机50套题目 2第二十一套给定程序中,函数fun的功能是:将形参s所指字符串中的所有数字字符顺序前移,其他字符顺序后移,处理后新字符串的首地址作为函数值返回。例如,s所指字符串为:asd123fgh5#43df, 处理后新字符串为:123543asdfgh#df。请在程序的下划线处填入正确的内容并把下划线删除,使程序得出正确的结果。#include #include #include #include char *fun(char *s) int i, j, k, n; char *p, *t; n=strlen(s)+1; t=(char*)malloc(n*sizeof(char

2、); p=(char*)malloc(n*sizeof(char); j=0; k=0; for(i=0; in; i+) if(isdigit(si) /*found*/ p_1_=si; j+; else tk=si; k+; /*found*/ for(i=0; i_2_; i+) pj+i= ti; pj+k=0;/*found*/ return _3_;main() char s80; printf(Please input: ); scanf(%s,s); printf(nThe result is: %sn,fun(s);第1空 参考答案:j第2空 参考答案:k第3空 参考答案:

3、p 给定程序MODI1.C中函数fun的功能是:首先把b所指字符串中的字符按逆序存放,然后将a所指字符串中的字符和b所指字符串中的字符,按排列的顺序交叉合并到c所指数组中,过长的剩余字符接在c所指数的尾部。例如,当a所指字符串中的内容为“abcdefg”,b所指字符串中的内容为“1234”时,c所指数组中的内容应该为“a4b3c2d1efg”;而当a所指字符串中的内容为“1234”,b所指内容的内容为“abcdefg”时,c所指数组中的内容应该为“1g2f3e4dcba”。请改正程序中的错误,使它能得出正确的结果。#include #include void fun( char *a, cha

4、r *b, char *c ) int i , j; char ch; i = 0; j = strlen(b)-1;/*found*/ while ( i j ) ch = bi; bi = bj; bj = ch; i+; j-; while ( *a | *b ) /*found*/ If ( *a ) *c = *a; c+; a+; if ( *b ) *c = *b; c+; b+; *c = 0;main() char s1100,s2100,t200; printf(nEnter s1 string : );scanf(%s,s1); printf(nEnter s2 stri

5、ng : );scanf(%s,s2); fun( s1, s2, t ); printf(nThe result is : %sn, t );第1处 参考答案:while(ij)第2处 参考答案:if(*a) 函数fun的功能是:将s所指字符串中下标为偶数同时ASCII值为奇数的字符删除,s所指串中剩余的字符形成的新串放在t所指的数组中。例如,若s所指字符串中的内容为“ABCDEFG12345”,其中字符C的ASCII码值为奇数,在数组中的下标为偶数,因此必须删除:而字符1的ASCII码值为奇数,在数组中的下标也为奇数,因此不应当删除,其他以此类推。最后t所指的数组中的内容应为“BDF123

6、45”。#include #include void fun(char *s, char t)main() char s100, t100;void NONO (); printf(nPlease enter string S:); scanf(%s, s); fun(s, t); printf(nThe result is: %sn, t); NONO();void NONO ()/* 本函数用于打开文件,输入数据,调用函数,输出数据,关闭文件。 */ char s100, t100 ; FILE *rf, *wf ; int i ; rf = fopen(C:k0124000101in.d

7、at,r) ; wf = fopen(C:k0124000101out.dat,w) ; for(i = 0 ; i 10 ; i+) fscanf(rf, %s, s) ; fun(s, t) ; fprintf(wf, %sn, t) ; fclose(rf) ; fclose(wf) ;第二十二套 给定程序中,函数fun的功能是:计算形参x所指数组中N个数的平均值(规定所有数均为正数),作为函数值返回:并将大于平均值的数放在形参y所指数组中,在主函数中输出。 列如,有10个正数:46 30 32 40 6 17 45 15 48 26,平均值为:30.500000 主函数中输出:46 3

8、2 40 45 48 请在程序的下划线处填入正确的内容并把下划线删除,使程序得出正确的结果。#include #include #define N 10double fun(double x,double *y) int i,j; double av;/*found*/ av=_1_;/*found*/ for(i=0; iN; i+) av = av + _2_; for(i=j=0; iav) y_3_= xi; yj=-1; return av;main() int i; double xN = 46,30,32,40,6,17,45,15,48,26; double yN; for(i

9、=0; i=0; i+) printf(%5.0f ,yi); printf(n);第1空 参考答案:0第2空 参考答案:xi/N第3空 参考答案:j+给定程序MODI1.C中函数fun的功能是: 根据整型形参m计算如下公式的值。y=#include /*found*/fun ( int m ) double y = 0, d ; int i ;/*found*/ for( i = 100, i = m, i += 100 ) d = (double)i * (double)i ; y += 1.0 / d ; return( y ) ;main( ) int n = 2000 ; print

10、f( nThe result is %lfn, fun ( n ) ) ;第1处 参考答案:double fun(int m)第2处 参考答案:for(i=100;i=m;i=i+100#include #include #define N 10typedef struct ss char num10; int s; STU;void fun( STU a, STU *s )main ( ) STU aN= A01,81,A02,89,A03,66,A04,87,A05,77, A06,90,A07,79,A08,61,A09,80,A10,71 , m ; int i;void NONO (

11、); printf(* The original data *n); for ( i=0; i N; i+ )printf(No = %s Mark = %dn, ai.num,ai.s); fun ( a, &m ); printf (* THE RESULT *n); printf (The lowest : %s , %dn,m.num, m.s); NONO( );void NONO ()/* 本函数用于打开文件,输入数据,调用函数,输出数据,关闭文件。 */ FILE *rf, *wf ; STU aN, m ; int i ; rf = fopen(C:k0124000101in.

12、dat,r) ; wf = fopen(C:k0124000101out.dat,w) ; for(i = 0 ; i 10; i+) fscanf(rf, %s %d, ai.num, &ai.s) ; fun(a, &m) ; fprintf (wf, The lowest : %s, %dn, m.num, m.s) ; fclose(rf) ; fclose(wf) ;第二十三套#include #include #define N 10double fun(double x,double *av) int i,j; double d,s; s=0; for(i=0; iN; i+)

13、s = s +xi;/*found*/ _1_=s/N; d=32767; for(i=0; iN; i+) if(xi*av & *av - xi=d)/*found*/ d=*av-xi; j=_2_;/*found*/ return _3_;main() int i; double xN= 46,30,32,40,6,17,45,15,48,26; double av,m; for(i=0; iN; i+) printf(%4.0f ,xi); printf(n); m=fun(x,&av); printf(nThe average is: %fn,av); printf(m=%5.0f

14、 ,m); printf(n);第1空 参考答案:*av第2空 参考答案:i第3空 参考答案:xj#include /*found*/int fun ( int n ) float A=1; int i;/*found*/ for (i=2; in; i+) A = 1/(1+A); return A ;main( ) int n ; printf(nPlease enter n: ) ; scanf(%d, &n ) ; printf(A%d=%fn, n, fun(n) ) ;第1处 参考答案:float fun(int n)第2处 参考答案:for(i=1;in;i+) #include

15、 #include #define N 5void fun ( int aN, int m )main ( ) int aNN, m, i, j;void NONO (); printf(* The array *n); for ( i =0; iN; i+ ) for ( j =0; j=3 ); printf(m = %4dn,m); fun ( a ,m ); printf (THE RESULTn); for ( i =0; iN; i+ ) for ( j =0; jN; j+ ) printf( %4d, aij ); printf(n); NONO ( );void NONO (

16、)/* 本函数用于打开文件,输入数据,调用函数,输出数据,关闭文件。 */ FILE *rf, *wf ; int i, j, n, a55 ; rf = fopen(C:k0124000101in.dat,r) ; wf = fopen(C:k0124000101out.dat,w) ; for(i = 0 ; i 5 ; i+) for(j = 0 ; j 5 ; j+) fscanf(rf, %d , &aij) ; fscanf(rf, %d, &n) ; fun(a, n) ; for ( i = 0; i 5; i+ ) for ( j = 0; j 5; j+ ) fprintf

17、(wf, %4d, aij ); fprintf(wf, n); fclose(rf) ; fclose(wf) ;第二十四套#include #include #define N 10double fun(double *x) int i, j; double s, av, yN; s=0; for(i=0; iN; i+) s=s+xi;/*found*/ av=_1_; for(i=j=0; iav )/*found*/ y_2_=xi; xi=-1; for(i=0; iN; i+)/*found*/ if( xi!= _3_) yj+=xi; for(i=0; iN; i+)xi =

18、 yi; return av;main() int i; double xN= 46,30,32,40,6,17,45,15,48,26; for(i=0; iN; i+) printf(%4.0f ,xi); printf(n); printf(nThe average is: %fn,fun(x); printf(nThe result :n,fun(x); for(i=0; iN; i+) printf(%5.0f ,xi); printf(n);第1空 参考答案:s/N第2空 参考答案:j+第3空 参考答案:-1 #include #include /*found*/include /

19、*found*/void upfst ( char p ) int k=0; for ( ; *p; p+ ) if ( k ) if ( *p = ) k = 0; else if ( *p != ) k = 1; *p = toupper( *p ); main( ) char chrstr81; printf( nPlease enter an English text line: ); gets( chrstr ); printf( nnBefore changing:n %s, chrstr ); upfst( chrstr ); printf( nAfter changing:n

20、%sn, chrstr );第1处 参考答案:#includestdio.h 第2处 参考答案:upfst(char*p)#include #include #define N 5double fun ( int wN )main ( ) int aNN=0,1,2,7,9,1,9,7,4,5,2,3,8,3,1,4,5,6,8,2,5,9,1,4,1; int i, j;void NONO (); double s ; printf(* The array *n); for ( i =0; iN; i+ ) for ( j =0; jN; j+ ) printf( %4d, aij ); p

21、rintf(n); s = fun ( a ); printf (* THE RESULT *n); printf( The sum is : %lfn,s ); NONO( );void NONO ()/* 本函数用于打开文件,输入数据,调用函数,输出数据,关闭文件。 */ FILE *rf, *wf ; int i, j, a55; double s ; rf = fopen(C:k0124000101in.dat,r) ; wf = fopen(C:k0124000101out.dat,w) ; for(i = 0 ; i 5 ; i+) for(j = 0 ; j 5 ; j+) fs

22、canf(rf, %d , &aij) ; s = fun(a) ; fprintf(wf, %lfn, s); fclose(rf) ; fclose(wf) ;第二十五套#include #include #define N 10double fun(double *x) int i, j; double av, yN; av=0;/*found*/ for(i=0; iN; i+) av +=_1_; for(i=j=0; iN; i+) if( xiav )/*found*/ yj=xi; xi=-1; _2_; i=0; while(iN) if( xi!= -1 ) yj+=xi;

23、/*found*/ _3_; for(i=0; iN; i+)xi = yi; return av;main() int i; double xN; for(i=0; iN; i+) xi=rand()%50; printf(%4.0f ,xi); printf(n); printf(nThe average is: %fn,fun(x); printf(nThe result :n,fun(x); for(i=0; iN; i+) printf(%5.0f ,xi); printf(n);第1空 参考答案:xi/N第2空 参考答案:j+第3空 参考答案:i+ #include void fun ( char *s, int num5 ) int k, i=5; for ( k = 0; k= 0) numi+; main( ) char s181; int num15, i; printf( nPle

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

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