江苏省计算机等级考试上机材料(C语言)

cn++; } }

for(i=0;i

lena=strlen(tmp[i]); for(j=0;j=len) { strcpy(ch[count++],tmp[i]); break; } } }

return count; }

void main() {

char *s=\ int n,i; FILE *fp;

fp=fopen(\ if(fp==0)

{printf(\ n=findword(s,t,ch); for(i=0;i

printf(\ \ fprintf(fp,\ \ }

printf(\ fprintf(fp,\

fprintf(fp,\ fclose(fp); }

模拟测试题二:

改错:

while(iab[ib])//else (a[ia]>b[ib])

c[count++]=a[ia];//c[count]=a[ia];

printf(\编程:

#include #include

void josephu(int a[],int b[],int n,int m) {

int i=0,flag=1,cn=0; while(cn

if(a[i]==0) i=(i+1); else if(flag<3) { i=(i+1); flag++; }

else if(flag==3) { b[cn++]=a[i]; a[i]=0; flag=1; i=(i+1); } } }

void main() {

int n,m,i,a[100],b[100]; FILE *fp;

fp=fopen(\ if(fp==0)

{printf(\

printf(\ for(i=0;i

josephu(a,b,n,m); for(i=0;i

printf(\ fprintf(fp,\ }

fprintf(fp,\ fclose(fp); }

模拟测试题三:

改错:

int str_count(char string[],char substr[],int ioc[])//int str_count(char *string[],char *substr[],int ioc[]) for(j=i,k=0;substr[k]==string[j];k++,j++)//for(j=i,k=0;substr[k]==string[k];k++,j++) ioc[m++]=i+1;//ioc[++m]=i+1;

char str[80]=\编程:

#include #include

void squeeze(char *s1,char *s2,char *s3) {

char *p,*q; int i=0; while(*s1) {

p=s2;

while(*p&&*p!=*s1) p++; if(*p) { s3[i++]=*s1; q=s1; while(*q) { *q=*(q+1); q++; } s1--; } s1++; }

s3[i]=0; }

void main() {

FILE *fp;

char *s1=\ fp=fopen(\ if(fp==0)

{printf(\ squeeze(s1,s2,s3); printf(\ fprintf(fp,\ printf(\ fprintf(fp,\

fprintf(fp,\ fclose(fp); }

模拟测试题四:

改错:

#define N 10//#define N=10

void yanghui(int y[][N],int x[][N],int n)//void yanghui(int y[][N],x[][N],n) y[i][j]=y[i-1][j-1]+y[i-1][j];//y[i][j]=y[i-1][j+1]+y[i-1][j]; for(j=0;j

#include #include #include #include char *insert(char *p) {

char *q=p,temp[20]; while(*p) {

while(*p&&isalpha(*p)) p++; if(*p) { strcpy(temp,p); *p++='-'; strcpy(p,temp); }

while(*p&&isdigit(*p)) p++; }

return q; }

void main() {

FILE *fp;

char *p=\ fp=fopen(\ if(fp==0)

{printf(\ q=insert(p); printf(\ fprintf(fp,\

fprintf(fp,\ fclose(fp); }

模拟测试题五:

改错:

void insert_date(int y,int m,int d,char *s,int n)//void insert_date(int y,int m,int d,char s,int n) y%=(int)pow(10,3-i);//y/=(int)pow(10,3-i); strcat(s,t);//strcpy(s,t);

联系客服:779662525#qq.com(#替换为@)