




已閱讀5頁(yè),還剩115頁(yè)未讀, 繼續(xù)免費(fèi)閱讀
版權(quán)說(shuō)明:本文檔由用戶提供并上傳,收益歸屬內(nèi)容提供方,若內(nèi)容存在侵權(quán),請(qǐng)進(jìn)行舉報(bào)或認(rèn)領(lǐng)
文檔簡(jiǎn)介
學(xué)而優(yōu)二級(jí)C上機(jī)考試試題 學(xué)而優(yōu)教育二級(jí)C上機(jī)考試復(fù)習(xí)資料 V16.0(共50套題目)第1套 1、程序填空題 #include #include double fun(double x) double f, t; int n; f = 1.0 + x;/*found*/ t = _x_1_; n = 1; do n+;/*found*/ t *= (-1.0)*x/_2_n_; f += t; /*found*/ while (_3_ _f= 1e-6); return f;main() double x, y; x=2.5; y = fun(x); printf(nThe result is :n); printf(x=%-12.6f y=%-12.6fn, x, y);2、程序修改題 #include long fun(int x,int y,long *p ) int i; long t=1;/*found*/ for(i=1-0; iy; i+) t=t*x; *p=t;/*found*/ t=t/-%1000; return t;main() long t,r; int x,y; printf(nInput x and y: ); scanf(%ld%ld,&x,&y); t=fun(x,y,&r); printf(nnx=%d, y=%d, r=%ld, last=%ldnn,x, y,r,t );3、程序設(shè)計(jì)題 #include #include double fun(double x)main() double x,s; printf(Input x: ); scanf(%lf,&x); s=fun(x); printf(s=%fn,s);第2套 1、程序填空題 #include int c1,c2,c3;void fun(long n) c1 = c2 = c3 = 0; while (n) /*found*/ switch(_1_) /*found*/ case 1: c1+;_2_;/*found*/ case 2: c2+;_3_; case 3: c3+; n /= 10; main() long n=123114350L; fun(n); printf(nThe result :n); printf(n=%ld c1=%d c2=%d c3=%dn,n,c1,c2,c3);2、程序修改題 #include int fun(unsigned n, int *zero) int count=0,max=0,t; do t=n%10;/*found*/ if(t=0) count+; if(maxt) max=t; n=n/10; while(n);/*found*/ zero=count; return max;main() unsigned n; int zero,max; printf(nInput n(unsigned): ); scanf(%d,&n); max = fun( n,&zero ); printf(nThe result: max=%d zero=%dn,max,zero);3、程序設(shè)計(jì)題 #include double fun(int n)main() int n; double s; printf(nInput n: ); scanf(%d,&n); s=fun(n); printf(nns=%fnn,s);第3套 1、程序填空題 #include unsigned long fun(unsigned long n) unsigned long x=0; int t; while(n) t=n%10;/*found*/ if(t%2=_1_)/*found*/ x=_2_+t;/*found*/ n=_3_; return x;main() unsigned long n=-1; while(n99999999|n0) printf(Please input(0n100000000): ); scanf(%ld,&n); printf(nThe result is: %ldn,fun(n);2、程序修改題 #include void fun (long s, long *t) int d; long sl=1;/*found*/ t = 0; while ( s 0) d = s%10;/*found*/ if (d%2 = 0) *t = d * sl + *t;sl *= 10; s /= 10; main() long s, t; printf(nPlease enter s:); scanf(%ld, &s); fun(s, &t); printf(The result is: %ldn, t);3、程序設(shè)計(jì)題 #include void fun(char p1, char p2)main() printf(Enter s1 and s2:n) ; scanf(%s%s, s1, s2) ; printf(s1=%sn, s1) ; printf(s2=%sn, s2) ; printf(Invoke fun(s1,s2):n) ; fun(s1, s2) ; printf(After invoking:n) ; printf(%sn, s1) ;第4套 1、程序填空題 #include #define M 3#define N 4void fun(int (*a)N) int i=0,j,find=0,rmax,c,k; while( (iM) & (!find) rmax=ai0; c=0; for(j=1; jN; j+) if(rmaxaij) /*found*/ rmax=aij; c= _1_ ; find=1; k=0; while(kM & find) /*found*/ if (k!=i & akc=rmax) find= _2_ ; k+; if(find) printf(find: a%d%d=%dn,i,c,aic);/*found*/ _3_ ; if(!find) printf(not found!n);main() int xMN,i,j; printf(Enter number for array:n); for(i=0; iM; i+) for(j=0; jN; j+) scanf(%d,&xij); printf(The array:n); for(i=0; iM; i+) for(j=0; jN; j+) printf(%3d,xij); printf(nn); fun(x);2、程序修改題 #include double fun ( int m ) double y = 1.0 ; int i ;/*found*/ for(i = 2 ; i m ; i+)/*found*/ y -= 1 /(i * i) ; return( y ) ;main( ) int n = 5 ; printf( nThe result is %lfn, fun ( n ) ) ;3、程序設(shè)計(jì)題 #include #include int fun(int score, int m, int below)main( ) int score9 = 10, 20, 30, 40, 50, 60, 70, 80, 90 ; n = fun(score, 9, below) ; printf( nBelow the average score are: ) ; for (i = 0 ; i n ; i+) printf(%d , belowi) ;第5套 1、程序填空題 #include #include #define N 5#define M 10/*found*/void fun(char (*ss) _1_, int k) int i=0 ;/*found*/ while(i _2_) /*found*/ ssik=_3_; i+; main() char xNM=Create,Modify,Sort,skip,Delete; int i; printf(nThe original stringnn); for(i=0;iN;i+)puts(xi); printf(n); fun(x,4); printf(nThe string after deleted :nn); for(i=0; iN; i+) puts(xi); printf(n);2、程序修改題 #include #include double fun(double eps) double s,t; int n=1; s=0.0;/*found*/ t=0; while( teps) s+=t; t=t * n/(2*n+1); n+; /*found*/ return(s);main() double x; printf(nPlease enter a precision: ); scanf(%lf,&x); printf(neps=%lf, Pi=%lfnn,x,fun(x);3、程序設(shè)計(jì)題 #include void fun( char *a, int n ) /* 以下代碼僅供參考 */ int i=0,j,k=0; while(ak=*) k+; /* k為統(tǒng)計(jì)*字符個(gè)數(shù) */ if(kn) i=n;j=k; /* 以下完成將下標(biāo)為k至串尾的字符前移k-n個(gè)位置 */ main() printf(Enter a string:n);gets(s); printf(Enter n : );scanf(%d,&n); fun( s,n ); printf(The string after deleted:n);puts(s);第6套 1、程序填空題 #include #define N 4/*found*/void fun(int (*t)_1_ ) int i, j; for(i=1; iN; i+) for(j=0; ji; j+) /*found*/ _2_ =tij+tji;/*found*/ _3_ =0; main() int tN=21,12,13,24,25,16,47,38,29,11,32,54,42,21,33,10, i, j; printf(nThe original array:n); for(i=0; iN; i+) for(j=0; jN; j+) printf(%2d ,tij); printf(n); fun(t); printf(nThe result is:n); for(i=0; iN; i+) for(j=0; jN; j+) printf(%2d ,tij); printf(n); 2、程序修改題 #include #include #include /*found*/#define FU(m,n) (m/n)float fun(float a,float b,float c) float value; value=FU(a+b,a-b)+FU(c+b,c-b);/*found*/ Return(Value);main() float x,y,z,sum; printf(Input x y z: ); scanf(%f%f%f,&x,&y,&z); printf(x=%f,y=%f,z=%fn,x,y,z); if (x=y|y=z)printf(Data error!n);exit(0); sum=fun(x,y,z); printf(The result is : %5.2fn,sum);3、程序設(shè)計(jì)題 #include void fun( char *a )main() char s81; printf(Enter a string:n);gets(s); fun( s ); printf(The string after deleted:n);puts(s);第7套 1、程序填空題 #include #define N 3#define M 4/*found*/void fun(int (*a)N, int _1_) int i,temp ;/*found*/ for(i = 0 ; i _2_ ; i+) temp=a0i ;/*found*/ a0i = _3_ ; aki = temp ; main() int xMN= 1,2,3,4,5,6,7,8,9,10,11,12 ,i,j; printf(The array before moving:nn); for(i=0; iM; i+) for(j=0; jN; j+) printf(%3d,xij); printf(nn); fun(x,2); printf(The array after moving:nn); for(i=0; iM; i+) for(j=0; jN; j+) printf(%3d,xij); printf(nn); 2、程序修改題 #include #include void fun( char t ) char c; int i, j;/*found*/ for( i = strlen( t ); i; i- ) for( j = 0; j i; j+ )/*found*/ if( tj t j + 1 ) c = tj; tj = t j + 1 ; tj + 1 = c; main() char s81; printf( nPlease enter a character string: ); gets( s ); printf( nnBefore sorting:n %s, s ); fun( s ); printf( nAfter sorting decendingly:n %sn, s );3、程序設(shè)計(jì)題 #include #include void fun( char *ss )void main( void ) printf( nPlease enter an character string within 50 characters:n ); gets( tt ); printf( nnAfter changing, the stringn %s, tt ); fun(tt) ; printf( nbecomesn %s, tt );第8套 1、程序填空題 #include int fun(int x) int n, s1, s2, s3, t; n=0; t=100;/*found*/ while(t=_1_)/*found*/ s1=t%10; s2=(_2_)%10; s3=t/100;/*found*/ if(s1+s2+s3=_3_) printf(%d ,t); n+; t+; return n;main() int x=-1; while(x0): ); scanf(%d,&x); printf(nThe result is: %dn,fun(x);2、程序修改題 #include /*found*/void fun (long s, long t) long sl=10; s /= 10; *t = s % 10;/*found*/ while ( s 0) s = s/100; *t = s%10*sl + *t; sl = sl * 10; main() long s, t; printf(nPlease enter s:); scanf(%ld, &s); fun(s, &t); printf(The result is: %ldn, t);3、程序設(shè)計(jì)題 #include #define N 16typedef struct char num10; int s; STREC;void fun( STREC a ) STREC tmp; int i,j; for(i = 0; i N; i+) for(j = i+1; j N; j+) /* 請(qǐng)按題目要求完成以下代碼 */ main() STREC sN=GA005,85,GA003,76,GA002,69,GA004,85,GA001,91,GA007,72,GA008,64,GA006,87,GA015,85,GA013,91,GA012,64,GA014,91,GA011,66,GA017,64,GA018,64,GA016,72; int i;FILE *out ; fun( s ); printf(The data after sorted :n); for(i=0;iN; i+) if( (i)%4=0 )printf(n); printf(%s %4d ,si.num,si.s); printf(n); out = fopen(out.dat,w) ; for(i=0;iN; i+) if( (i)%4=0 & i) fprintf(out, n); fprintf(out, %4d ,si.s); fprintf(out,n); fclose(out) ;第9套 1、程序填空題 #include #define N 4fun(int tN, int n) int i, sum;/*found*/ _1_; for(i=0; in; i+)/*found*/ sum+=_2_ ; for(i=0; in; i+)/*found*/ sum+= tin-i-_3_ ; return sum;main() int tN=21,2,13,24,25,16,47,38,29,11,32,54,42,21,3,10,i,j; printf(nThe original data:n); for(i=0; iN; i+) for(j=0; jN; j+) printf(%4d,tij); printf(n); printf(The result is: %d,fun(t,N);2、程序修改題 #include #include double funx(double x) return(2*x*x*x-4*x*x+3*x-6); double fun( double m, double n)/*found*/ int r; r=(m+n)/2;/*found*/ while(fabs(n-m)0.001) if(funx(r)*funx(n)0) m=r;else n=r;r=(m+n)/2; return r;main( ) double m,n, root; printf(Enter m n : n); scanf(%lf%lf,&m,&n); root=fun( m,n ); printf(root = %6.3fn,root);3、程序設(shè)計(jì)題 #include void fun( char *a, char *h,char *p )main() char s81,*t, *f; printf(Enter a string:n);gets(s); t=f=s; while(*t)t+; t-; while(*t=*)t-; while(*f=*)f+; fun( s , f,t ); printf(The string after deleted:n);puts(s);第10套 1、程序填空題 #include /*found*/_1_ fun(char ch)/*found*/ if (ch=0 & _2_)/*found*/ return 9- (ch-_3_); return ch ;main() char c1, c2; printf(nThe 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);2、程序修改題 #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) /*found*/ 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);3、程序設(shè)計(jì)題 #include #include #define N 8struct slist double s; struct slist *next;typedef struct slist STREC;double 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);main() 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);第11套 1、程序填空題 #include double fun(double e) int i; double s, x;/*found*/ s=0; i=_1_; x=1.0; while(xe)/*found*/ _2_;/*found*/ x=(2.0*i-1)/(_3_)*(2.0*i); s=s+x; return s;main() double e=1e-3; printf(nThe result is: %fn,fun(e);2、程序修改題 #include #include /*found*/void fun (char s, char t) int i, d; d = strlen(s); for (i = 0; id; i+) ti = si; for (i = 0; id; i+) td+i = sd-1-i;/*found*/ t2*d-1 = 0;main() char s100, t100; printf(nPlease enter string S:); scanf(%s, s); fun(s, t); printf(nThe result is: %sn, t);3、程序設(shè)計(jì)題 #include #include void fun(char *s, char t)main() printf(nPlease enter string S:); scanf(%s, s); fun(s, t); printf(nThe result is: %sn, t);第12套 1、程序填空題 #include #define N 5typedef struct student long sno; char name10; float score3; STU;void fun(char *filename, long sno) FILE *fp; STU n; int i; fp = fopen(filename,rb+);/*found*/ while (!feof(_1_) fread(&n, sizeof(STU), 1, fp);/*found*/ if (n.sno_2_sno) break; if (!feof(fp) for (i=0; i3; i+) n.scorei += 3;/*found*/ fseek(_3_, -(long)sizeof(STU), SEEK_CUR); fwrite(&n, sizeof(STU), 1, fp); fclose(fp);main() STU tN= 10001,MaChao, 91, 92, 77, 10002,CaoKai, 75, 60, 88, 10003,LiSi, 85, 70, 78, 10004,FangFang, 90, 82, 87, 10005,ZhangSan, 95, 80, 88, ssN; int i,j; FILE *fp; fp = fopen(student.dat, wb); fwrite(t, sizeof(STU), N, fp); fclose(fp); printf(nThe original data :n); fp = fopen(student.dat, rb); fread(ss, sizeof(STU), N, fp); fclose(fp); for (j=0; jN; j+) printf(nNo: %ld Name: %-8s Scores: ,ssj.sno, ); for (i=0; i3; i+) printf(%6.2f , ssj.scorei); printf(n); fun(student.dat, 10003); fp = fopen(student.dat, rb); fread(ss, sizeof(STU), N, fp); fclose(fp); printf(nThe data after modifing :n); for (j=0; jN; j+) printf(nNo: %ld Name: %-8s Scores: ,ssj.sno, ); for (i=0; i3; i+) printf(%6.2f , ssj.scorei); printf(n); 2、程序修改題 #include #include #define N 80void insert(char *aa) int i,j,n; char ch;/*found*/ n=strlen aa ; for( i=1; i=0) & ( chaaj ) aaj+1=aaj; j-; aaj+1=ch; main( ) char aN=QWERTYUIOPASDFGHJKLMNBVCXZ; printf (The original string : %sn, a); insert(a) ; printf(The string after sorting : %snn,a );3、程序設(shè)計(jì)題 #include #include #define N 8struct slist double s; struct slist *next;typedef struct slist STREC;double fun( STREC
溫馨提示
- 1. 本站所有資源如無(wú)特殊說(shuō)明,都需要本地電腦安裝OFFICE2007和PDF閱讀器。圖紙軟件為CAD,CAXA,PROE,UG,SolidWorks等.壓縮文件請(qǐng)下載最新的WinRAR軟件解壓。
- 2. 本站的文檔不包含任何第三方提供的附件圖紙等,如果需要附件,請(qǐng)聯(lián)系上傳者。文件的所有權(quán)益歸上傳用戶所有。
- 3. 本站RAR壓縮包中若帶圖紙,網(wǎng)頁(yè)內(nèi)容里面會(huì)有圖紙預(yù)覽,若沒(méi)有圖紙預(yù)覽就沒(méi)有圖紙。
- 4. 未經(jīng)權(quán)益所有人同意不得將文件中的內(nèi)容挪作商業(yè)或盈利用途。
- 5. 人人文庫(kù)網(wǎng)僅提供信息存儲(chǔ)空間,僅對(duì)用戶上傳內(nèi)容的表現(xiàn)方式做保護(hù)處理,對(duì)用戶上傳分享的文檔內(nèi)容本身不做任何修改或編輯,并不能對(duì)任何下載內(nèi)容負(fù)責(zé)。
- 6. 下載文件中如有侵權(quán)或不適當(dāng)內(nèi)容,請(qǐng)與我們聯(lián)系,我們立即糾正。
- 7. 本站不保證下載資源的準(zhǔn)確性、安全性和完整性, 同時(shí)也不承擔(dān)用戶因使用這些下載資源對(duì)自己和他人造成任何形式的傷害或損失。
最新文檔
- 中獸醫(yī)學(xué)知到課后答案智慧樹(shù)章節(jié)測(cè)試答案2025年春甘肅農(nóng)業(yè)大學(xué)
- 通遼職業(yè)學(xué)院《微型飛行器設(shè)計(jì)導(dǎo)論》2023-2024學(xué)年第二學(xué)期期末試卷
- 上海工程技術(shù)大學(xué)《道橋施工技術(shù)1》2023-2024學(xué)年第一學(xué)期期末試卷
- 陜西鐵路工程職業(yè)技術(shù)學(xué)院《土木工程制圖D》2023-2024學(xué)年第一學(xué)期期末試卷
- 山西同文職業(yè)技術(shù)學(xué)院《建設(shè)項(xiàng)目檔案管理》2023-2024學(xué)年第二學(xué)期期末試卷
- 2024-2025學(xué)年湖南省岳陽(yáng)市高中名校普通高考第二次適應(yīng)性檢測(cè)試題英語(yǔ)試題含解析
- 湖南司法警官職業(yè)學(xué)院《植物醫(yī)學(xué)概論》2023-2024學(xué)年第二學(xué)期期末試卷
- 濰坊科技學(xué)院《電路原理實(shí)驗(yàn)》2023-2024學(xué)年第二學(xué)期期末試卷
- 湖南省常德市武陵區(qū)芷蘭實(shí)驗(yàn)學(xué)校歷史班2024-2025學(xué)年下學(xué)期高三語(yǔ)文試題1月階段測(cè)試考試試卷含解析
- 公司訴訟制度優(yōu)化建議
- 全國(guó)職業(yè)院校技能大賽(新材料智能生產(chǎn)與檢測(cè)賽項(xiàng))選拔賽試題庫(kù)(300題)
- 幼兒園夏季護(hù)理培訓(xùn)
- 高等職業(yè)學(xué)校電梯工程技術(shù)專業(yè)實(shí)訓(xùn)教學(xué)條件建設(shè)標(biāo)準(zhǔn)(征求意見(jiàn)稿)
- 2024年錦州師范高等??茖W(xué)校單招職業(yè)技能測(cè)試題庫(kù)及答案解析
- 2024年國(guó)家電網(wǎng)招聘之通信類題庫(kù)附參考答案(考試直接用)
- 《市場(chǎng)營(yíng)銷學(xué) 第3版》課件全套 段淑梅 第1-12章 市場(chǎng)營(yíng)銷概論-市場(chǎng)營(yíng)銷組合
- 大學(xué)生信息素養(yǎng)大賽考試題庫(kù)及答案
- 兒童保?。祻?fù))管理信息系統(tǒng)需求說(shuō)明
- 文獻(xiàn)檢索與論文寫(xiě)作
- 《麻醉與BIS監(jiān)測(cè)》課件
- 嶺南版二年級(jí)美術(shù)上冊(cè)期末試題B
評(píng)論
0/150
提交評(píng)論