全國(guó)計(jì)算機(jī)等級(jí)考試二級(jí)C語(yǔ)言機(jī)試題庫(kù)2011.doc_第1頁(yè)
全國(guó)計(jì)算機(jī)等級(jí)考試二級(jí)C語(yǔ)言機(jī)試題庫(kù)2011.doc_第2頁(yè)
全國(guó)計(jì)算機(jī)等級(jí)考試二級(jí)C語(yǔ)言機(jī)試題庫(kù)2011.doc_第3頁(yè)
全國(guó)計(jì)算機(jī)等級(jí)考試二級(jí)C語(yǔ)言機(jī)試題庫(kù)2011.doc_第4頁(yè)
全國(guó)計(jì)算機(jī)等級(jí)考試二級(jí)C語(yǔ)言機(jī)試題庫(kù)2011.doc_第5頁(yè)
已閱讀5頁(yè),還剩246頁(yè)未讀, 繼續(xù)免費(fèi)閱讀

下載本文檔

版權(quán)說(shuō)明:本文檔由用戶(hù)提供并上傳,收益歸屬內(nèi)容提供方,若內(nèi)容存在侵權(quán),請(qǐng)進(jìn)行舉報(bào)或認(rèn)領(lǐng)

文檔簡(jiǎn)介

20113C01funn ,n 27638496739 , BLANK1.C #include void fun(unsigned long *n) unsigned long x=0, i; int t;i=1;while(*n) t=*n % _1_;if(t%2!= _2_) x=x+t*i; i=i*10; * n =*n /10;* n=_3_;main() unsigned long n=-1;while(n99999999|n0) printf(Please input(0n100000000): ); scanf(%ld,&n); fun(&n);printf(nThe result is: %ldn,n);t*n100nxx*MODI1.C fun n!n5120.000000main#include double fun ( int n ) double result = 1.0 ;if n = = 0return 1.0 ;while( n 1 & n 170 )result *= n-return result ;main ( ) int n ;printf(Input N:) ;scanf(%d, &n) ;printf(nn%d! =%lfnn, n, fun(n) ;if (n=0)*fun(C)-1234, -1234fun: PROG1.Cmain fun#include #include long fun ( char *p)int i, len, t; /* lent */long x=0;len=strlen(p);if(p0=-) t=-1; len-; p+; else t=1;/* */return x*t;main() /* */ char s6;long n;printf(Enter a string:n) ;gets(s);n = fun(s);printf(%ldn,n);NONO ( );NONO ( )/* */FILE *fp, *wf ;int i ;char s20 ;long n ;fp = fopen(c:testin.dat,r) ;wf = fopen(c:testout.dat,w) ;for(i = 0 ; i 10 ; i+) fscanf(fp, %s, s) ;n = fun(s);fprintf(wf, %ldn, n) ;fclose(fp) ;fclose(wf) ;#include #include long fun ( char *p)/* */int i, len, t; /* lent */long x=0;len=strlen(p);if(p0=-) t=-1; len-; p+; else t=1;/* */while(*p) x = x*10-48+(*p+);return x*t;main() /* */ char s6;long n;printf(Enter a string:n) ;gets(s);n = fun(s);printf(%ldn,n);NONO ( );NONO ( )/* */* */FILE *fp, *wf ;int i ;char s20 ;long n ;fp = fopen(c:testin.dat,r) ;wf = fopen(c:testout.dat,w) ;for(i = 0 ; i 10 ; i+) fscanf(fp, %s, s) ;n = fun(s);fprintf(wf, %ldn, n) ;fclose(fp) ;fclose(wf) ;NONO( )2NONO( )02,fun, BLANK1.C#include void fun(char *s, int a, double f)/*found*/_1_ fp;char ch;fp = fopen(file1.txt, w);fprintf(fp, %s %d %fn, s, a, f);fclose(fp);fp = fopen(file1.txt, r);printf(nThe result :nn);ch = fgetc(fp);/*found*/while (!feof(_2_) /*found*/putchar(_3_); ch = fgetc(fp); putchar(n);fclose(fp);main() char a10=Hello!; int b=12345;double c= 98.76;fun(a,b,c);/* */FILE *fpch*MODI1.Cfun: , , fun, : main, , !#include void fun(char *s) int i,j;for(i=0,j=0; si!=0; i+)if(si=0 & si=9)/*found*/sj=si;/*found*/sj=0;main() char item80;printf(nEnter a string : );gets(item);printf(nnThe string is : %sn,item);fun(item);printf(nnThe string of changing is : %sn,item );: jsj+=si;: sj=0;.*fun, : MN, , :W W W WS S S SH H H H: WSHWSHWSHPROG1.Cmain, fun#include #define M 3#define N 4/* */void fun(char sN, char *b)int i,j,n=0;for(i=0; i N;i+) /* */bn=0;main() char a100,wMN=W,W,W,W,S,S,S,S,H,H,H,H;int i,j;printf(The matrix:n);for(i=0; iM; i+) for(j=0;jN; j+)printf(%3c,wij);printf(n);fun(w,a);printf(The A string:n);puts(a);printf(nn);NONO();1. 2. void fun(char sN, char *b)/* */int i,j,n=0;for(i=0; i N;i+) /* */for(j = 0 ; j M ; j+) bn = sji ;n = i * M + j + 1;bn=0;033funfilename, /* */BLANK1.C#include #define N 5typedef struct student long sno;char name10;float score3; STU;void fun(char *filename, STU n) FILE *fp;/*found*/fp = fopen(_1_, rb+);/*found*/fseek(_2_, -1L*sizeof(STU), SEEK_END);/*found*/fwrite(&n, sizeof(STU), 1, _3_);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;STU n=10006,ZhaoSi, 55, 70, 68, ssN;int i,j; FILE *fp;fp = fopen(student.dat, wb);fwrite(t, sizeof(STU), N, fp);fclose(fp);fp = fopen(student.dat, rb);fread(ss, sizeof(STU), N, fp);fclose(fp);printf(nThe original data :nn);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, n);printf(nThe data after modifing :nn);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);/* */filenamefpfpfpfp*MODI1.CCreatlink, 0m-1Creatlink, : main, , !#include #include typedef struct aa int data;struct aa *next; NODE;NODE *Creatlink(int n, int m) NODE *h=NULL, *p, *s;int i;/*found*/p=(NODE )malloc(sizeof(NODE);h=p;p-next=NULL;for(i=1; idata=rand()%m; s-next=p-next;p-next=s; p=p-next;/*found*/return p;outlink(NODE *h) NODE *p;p=h-next;printf(nnTHE LIST :nn HEAD );while(p) printf(-%d ,p-data);p=p-next;printf(n);main() NODE *head;head=Creatlink(8,22);/* */outlink(head);: p=(NODE *)malloc(sizeof(NODE);: hppph*fun, :, , PROG1.Cmain, fun#include #include #define N 80int fun( char *s)main() char lineN; int num=0;printf(Enter a string :n); gets(line);num=fun( line );printf(The number of word is : %dnn,num);NONO();1. whilek12. kint fun( char *s)int k = 1 ;while(*s) if(*s = ) k+ ;s+ ;return k ;043funfilename,filename, BLANK1.C#include #define N 5typedef struct student long sno;/* */char name10;float score3; STU;void fun(char *filename) FILE *fp; int i, j;STU sN, t;/*found*/fp = fopen(filename, _1_);fread(s, sizeof(STU), N, fp);fclose(fp);for (i=0; iN-1; i+)for (j=i+1; jN; j+)/*found*/if (si.sno _2_ sj.sno) t = si; si = sj; sj = t; fp = fopen(filename, wb);/*found*/_3_(s, sizeof(STU), N, fp); /* */fclose(fp);main() STU tN= 10005,ZhangSan, 95, 80, 88, 10003,LiSi, 85, 70, 78,10002,CaoKai, 75, 60, 88, 10004,FangFang, 90, 82, 87,10001,MaChao, 91, 92, 77, ssN;int i,j; FILE *fp;fp = fopen(student.dat, wb);fwrite(t, sizeof(STU), 5, fp);fclose(fp);printf(nnThe original data :nn);for (j=0; jN; j+) printf(nNo: %ld Name: %-8s Scores: ,tj.sno, );for (i=0; i3; i+) printf(%6.2f , tj.scorei);printf(n);fun(student.dat);printf(nnThe data after sorting :nn);fp = fopen(student.dat, rb);fread(ss, sizeof(STU), 5, fp);fclose(fp);for (j=0; jN; j+) printf(nNo: %ld Name: %-8s Scores: ,ssj.sno, );for (i=0; ifwrite*MODI1.Cfun: n*, , : 79fun, : main, , !#include #include void fun ( char s, int n )char a80 , *p;int i;/*found*/s=p;for(i=0; in; i+) ai=*;do ai=*p;i+;/*found*/while(*p+)ai=0;strcpy(s,a);main() int n; char s80;printf(nEnter a string : ); gets(s);printf(nThe string %sn,s);printf(nEnter n ( number of * ) : ); scanf(%d,&n);fun(s,n);printf(nThe string after insert : %s n ,s);: psp=s;: do whilepwhile(*p+);*fun,:N,age09d0,1019d1,2029d2, 100 (100)d10/* */PROG1.Cmain,fun#include #define N 50#define M 11void fun( int *a, int *b)double rnd() static t=29,c=217,m=1024,r=0;r=(r*t+c)%m; return(double)r/m);main() int ageN, i, dM;for(i=0; iN;i+)agei=(int)(115*rnd();printf(The original data :n);for(i=0;iN;i+) printf(i+1)%10=0?%4dn:%4d,agei);printf(nn);fun( age, d);for(i=0;i10;i+)printf(%4d-%4d : %4dn,i*10,i*10+9,di);printf( Over 100 : %4dn,d10);NONO(d);1. 02. for10d10110void fun( int *a, int *b)int i, j ;for(i = 0 ; i M ; i+) bi = 0 ;/* */for(i = 0 ; i 10) bM - 1+ ; else bj+ ;double rnd() static t=29,c=217,m=1024,r=0;r=(r*t+c)%m; return(double)r/m);05,funatoiatof, BLANK1.C#include #include void fun(char *s, int a, double f)/*found*/_1_ fp;char str100, str1100, str2100;int a1; double f1;fp = fopen(file1.txt, w);/* */fprintf(fp, %s %d %fn, s, a, f);/*found*/_2_ ;fp = fopen(file1.txt, r);/*found*/fscanf(_3_,%s%s%s, str, str1, str2);fclose(fp);a1 = atoi(str1);f1 = atof(str2);printf(nThe result :nn%s %d %fn, str, a1, f1);main() char a10=Hello!; int b=12345;double c= 98.76;fun(a,b,c);FILE *fclose(fp)fp*MODI1.Cfun: N,m(m10), , fun, : main, , !#include #include #include #define N 10typedef struct ss char num10;int s; STU;STU *fun(STU a, int m) STU bN, *t;int i,j,k;/*found*/t=(STU *)calloc(sizeof(STU),m)for(i=0; iN; i+) bi=ai;for(k=0; km; k+) for(i=j=0; i bj.s) j=i;/*found*/* www.gre

溫馨提示

  • 1. 本站所有資源如無(wú)特殊說(shuō)明,都需要本地電腦安裝OFFICE2007和PDF閱讀器。圖紙軟件為CAD,CAXA,PROE,UG,SolidWorks等.壓縮文件請(qǐng)下載最新的WinRAR軟件解壓。
  • 2. 本站的文檔不包含任何第三方提供的附件圖紙等,如果需要附件,請(qǐng)聯(lián)系上傳者。文件的所有權(quán)益歸上傳用戶(hù)所有。
  • 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ì)用戶(hù)上傳內(nèi)容的表現(xiàn)方式做保護(hù)處理,對(duì)用戶(hù)上傳分享的文檔內(nèi)容本身不做任何修改或編輯,并不能對(duì)任何下載內(nèi)容負(fù)責(zé)。
  • 6. 下載文件中如有侵權(quán)或不適當(dāng)內(nèi)容,請(qǐng)與我們聯(lián)系,我們立即糾正。
  • 7. 本站不保證下載資源的準(zhǔn)確性、安全性和完整性, 同時(shí)也不承擔(dān)用戶(hù)因使用這些下載資源對(duì)自己和他人造成任何形式的傷害或損失。

評(píng)論

0/150

提交評(píng)論