⣨һ
и,funĹǣβaָеżԭ˳δŵa0ݡa1ݡa2ݡ,ɾ,żĸֵͨء
,aָеΪ9,1,4,2,3,6,5,8,7,ɾaָеΪ4,2,6,8,ֵΪ4
»ߴȷݲ»ɾ,ʹóȷĽ
ע⣺лɾУҲøĳĽṹ
#include  <stdio.h>
#define  N  9
int fun(int  a[], int  n)
{  int  i,j;
   j = 0;
   for (i=0; i<n; i++)
/**********found**********/
      if (___1___== 0) {
/**********found**********/
        ___2___ = a[i]; j++;
      }
/**********found**********/
   return ___3___;
}
main()
{  int  b[N]={9,1,4,2,3,6,5,8,7}, i, n;
   printf("\nThe original data  :\n");
   for (i=0; i<N; i++)  printf("%4d ", b[i]);
   printf("\n");
   n = fun(b, N);
   printf("\nThe number of even  %d\n", n);
   printf("\nThe even  :\n");
   for (i=0; i<n; i++)  printf("%4d ", b[i]);
   printf("\n");
}

⣨
иУfunĹǣβsַָѰcַͬһַ֮ͬҲַͬκδ
磬sַָΪ"baacda"cеַΪaִкsַָΪ"baaaacdaa"
»ߴȷݲ»ɾʹóȷĽ
лɾУҲøĳĽṹ
#include  <stdio.h>
void fun(char  *s, char  c)
{  int  i, j, n;
/**********found**********/
  for(i=0; s[i]!=___1___ ; i++)
     if(s[i]==c)
     {
/**********found**********/
        n=___2___ ;
        while(s[i+1+n]!='\0')  n++;
        for(j=i+n+1; j>i; j--)  s[j+1]=s[j];
/**********found**********/
        s[j+1]=___3___ ;
        i=i+1;
     }
}
main()
{  char  s[80]="baacda", c;
   printf("\nThe string:  %s\n",s);
   printf("\nInput a character:  ");  scanf("%c",&c);
   fun(s,c);
   printf("\nThe result is:  %s\n",s);
}

⣨
иУfunĹǣNNԽΪԳߣԳԪӲԪУԪΪ0
磬N3о
123
456
789
Ϊ
100
650
10 14 9
ڳ»ߴȷݲ»ɾʹóȷĽ
ע⣺лɾУҲøĳĽṹ
#include  <stdio.h>
#define  N  4
/**********found**********/
void fun(int  (*t)___1___ )
{  int  i, j;
   for(i=1; i<N; i++)
   {  for(j=0; j<i; j++)
      {
/**********found**********/
         ___2___ =t[i][j]+t[j][i];
/**********found**********/
         ___3___ =0;
      }
   }
}
main()
{  int  t[][N]={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; i<N; i++)
   {  for(j=0; j<N; j++)  printf("%2d  ",t[i][j]);
      printf("\n");
   }
   fun(t);
   printf("\nThe result is:\n");
   for(i=0; i<N; i++)
   {  for(j=0; j<N; j++)  printf("%2d  ",t[i][j]);
      printf("\n");
   }
}

⣨ģ
иУfunĹǣβsַָ±ΪַƵһλãұ߱Ƴַַƻطŵһλã±Ϊżַ(עַĳȴڵ2)
磬βsַָΪ"abcdefgh"ִнΪ"ahcbedgf"
»ߴȷݲ»ɾʹóȷĽ
ע⣺лɾУҲøĳĽṹ
#include  <stdio.h>
void fun(char  *s)
{  int  i, n, k;    char c;
   n=0;
   for(i=0; s[i]!='\0'; i++)  n++;
/**********found**********/
   if(n%2==0) k=n-___1___ ;
   else       k=n-2;
/**********found**********/
   c=___2___ ;
   for(i=k-2; i>=1; i=i-2)  s[i+2]=s[i];
/**********found**********/
   s[1]=___3___ ;
}
main()
{  char  s[80]="abcdefgh";
   printf("\nThe original string is :  %s\n",s);
   fun(s);
   printf("\nThe result is :  %s\n",s);
}

⣨壩
УfunĹǣβsַָұߵnַƵβtַָУγһ´sַָĳСnַƵβtַָС
磬βsַָΪabcdefghnֵΪ5ִкtַָеַӦΪdefgh
ڳ»ߴȷݲ»ɾʹóȷĽ
ע⣺лɾУҲøĳĽṹ
#include  <stdio.h>
#include  <string.h>
#define  N  80
void fun(char  *s, int  n, char  *t)
{ int len,i,j=0;
  len=strlen(s);
/**********found**********/
  if(n>=len) strcpy(__1__);
  else {
/**********found**********/
     for(i=len-n; i<=len-1; i++)  t[j++]= __2__ ;
/**********found**********/
     t[j]= __3__ ;
  }
}
main()
{ char  s[N],t[N]; int  n;
  printf("Enter a string:  ");gets(s);
  printf( "Enter n:");  scanf("%d",&n);
  fun(s,n,t);
  printf("The string t :  ");  puts(t);
}

⣨
УfunĹǣͳβsֵַַָĴβtָıУ磬βsַָΪ"abcdef35adgh3kjsdf7"Ϊ4
»ߴȷݲ»ɾʹóȷĽ
ע⣺лɾУҲøĳĽṹ
#include  <stdio.h>
void fun(char  *s, int  *t)
{  int i, n;
   n=0;
/**********found**********/
   for(i=0; ___1___ !=0; i++)
/**********found**********/
      if(s[i]>='0'&&s[i]<= ___2___ ) n++;
/**********found**********/
    ___3___ ;
}
main()
{  char  s[80]="abcdef35adgh3kjsdf7";
   int t;
   printf("\nThe original string is :  %s\n",s);
   fun(s,&t);
   printf("\nThe result is :  %d\n",t);
}

⣨ߣ
funĹǣꡢ¡գһĵڼ죬Ϊֵءк isleapбĳһǷΪꡣ
磬룺2008  5  1200851Ǹĵ122졣
ڳ»ߴȷݣ»ɾʹóȷ

ע⣺лɾУҲøĳĽṹ
#include  <stdio.h>
int  isleap(int  year)
{ int  leap;
  leap= (year%4==0 && year%100!=0 || year%400==0);
/**********found**********/
  return  __1__;
}
int fun(int  year, int  month, int  day)
{  int  table[13]={0,31,28,31,30,31,30,31,31,30,31,30,31};
   int  days=0 , i;
   for(i=1; i<month; i++)
      days=days + table[i];
/**********found**********/
   days=days+__2__ ;
   if( isleap(year) && month>2 )
 /**********found**********/
     days=days+__3__;
   return  days;
}
main()
{  int  year, month, day, days ;
   printf("ꡢ¡գ");
   scanf("%d%d%d",&year, &month, &day);
   days = fun(year, month, day); 
   printf("%d%d%dǸĵ%d\n",year, month, day, days);
}

⣨ˣ
УfunĹǣָβssַָеַɳ̵˳򣬲ssַָйNַҴСM
ڳ»ߴȷݲ»ɾʹóȷĽ
ע⣺лɾУҲøĳĽṹ
#include  <stdio.h>
#include  <string.h>
#define  N  5
#define  M  8
void fun(char  (*ss)[M])
{ char  *ps[N],*tp;    int  i,j,k;
  for(i=0; i<N; i++) ps[i]=ss[i];
  for(i=0; i<N-1; i++) {
/**********found**********/
    k=  __1__ ;
    for(j=i+1; j<N; j++)
/**********found**********/
       if(strlen(ps[k]) < strlen(__2__) ) k=j;
/**********found**********/
    tp=ps[i];  ps[i]=ps[k]; ps[k]= __3__ ;
  }
  printf("\nThe string after sorting by length:\n\n");
  for(i=0; i<N; i++)  puts(ps[i]);
}
main()
{ char  ch[N][M]={"red","green","blue","yellow","black"};
  int  i;
  printf("\nThe original string\n\n");
  for(i=0;i<N;i++)puts(ch[i]);  printf("\n");
  fun(ch);
}

⣨ţ
иУfunĹǣNNԽԪصֵ뷴Խ߶ӦλԪصֵн
磬N3о
123
456
789
Ϊ
321
456
987
»ߴȷݲ»ɾʹóȷĽ
ע⣺лɾУҲøĳĽṹ
#include  <stdio.h>
#define  N  4
/**********found**********/
void fun(int  ___1___ , int  n)
{  int  i,s;
/**********found**********/
   for(___2___; i++)
   {  s=t[i][i];
      t[i][i]=t[i][n-i-1];
/**********found**********/
      t[i][n-1-i]=___3___;
   }
}
main()
{  int  t[][N]={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; i<N; i++)
   {  for(j=0; j<N; j++)  printf("%d  ",t[i][j]);
      printf("\n");
   }
   fun(t,N);
   printf("\nThe result is:\n");
   for(i=0; i<N; i++)
   {  for(j=0; j<N; j++)  printf("%d  ",t[i][j]);
      printf("\n");
   }
}

⣨ʮ
иУfunĹǣβssַָвβtַָͬĴҵ󷵻ظôַеλ(±ֵ)δҵ򷵻-1ssַָйNݲַͬҴСM
»ߴȷݲ»ɾʹóȷĽ
ע⣺лɾУҲøĳĽṹ
#include  <stdio.h>
#include  <string.h>
#define  N  5
#define  M  8
int fun(char  (*ss)[M],char  *t)
{  int  i;
/**********found**********/
   for(i=0; i< __1__ ; i++)
/**********found**********/
     if(strcmp(ss[i],t)==0 ) return  __2__ ;
   return -1;
}
main()
{ char  ch[N][M]={"if","while","switch","int","for"},t[M];
  int  n,i;
  printf("\nThe original string\n");
  for(i=0;i<N;i++)puts(ch[i]);  printf("\n");
  printf("\nEnter a string for search:  ");  gets(t);
  n=fun(ch,t);
/**********found**********/
  if(n==  __3__)  printf("\nDon't found!\n");
  else  printf("\nThe position is  %d .\n",n);
}

⣨ʮһ
Աļ¼ɱźͳꡢ¡ɣNԱдṹstdСfunĹǣҳָݵԱݷβkָУͬʱɺֵָ
ڳ»ߴȷݲ»ɾʹóȷĽ
ע⣺лɾУҲøĳĽṹ
#include <stdio.h>
#define N 8
typedef  struct
{  int  num;
   int  year,month,day ;
}STU;
int fun(STU  *std, STU  *k, int  year)
{  int  i,n=0;
   for (i=0; i<N; i++)
/**********found**********/
      if(  ___1___==year)
/**********found**********/
         k[n++]= ___2___;
/**********found**********/
   return (___3___);
}
main()
{  STU  std[N]={ {1,1984,2,15},{2,1983,9,21},{3,1984,9,1},{4,1983,7,15},
                 {5,1985,9,28},{6,1982,11,15},{7,1982,6,22},{8,1984,8,19}};
   STU  k[N];         
   int  i,n,year;
   printf("Enter a year :  ");  scanf("%d",&year);
   n=fun(std,k,year);
   if(n==0)
      printf("\nNo person was born in %d \n",year);
   else
   {   printf("\nThese persons were born in %d \n",year);
       for(i=0; i<n; i++)
         printf("%d  %d-%d-%d\n",k[i].num,k[i].year,k[i].month,k[i].day);
   }
}

⣨ʮ
УfunĹǣβָָṹеԪذnumԱС
ڳ»ߴȷݲ»ɾʹóȷĽ
ע⣺лɾУҲøĳĽṹ
#include <stdio.h>
typedef struct
{  int  num;
   char  name[10];
}PERSON;
/**********found**********/
void fun(PERSON  ___1___)
{
/**********found**********/
   ___2___  temp;
   if(std[0].num>std[1].num)
  {  temp=std[0];  std[0]=std[1];  std[1]=temp;  }
   if(std[0].num>std[2].num)
  {  temp=std[0];  std[0]=std[2];  std[2]=temp; }
   if(std[1].num>std[2].num)
  {  temp=std[1];  std[1]=std[2];  std[2]=temp;  }
}
main()
{  PERSON  std[ ]={ 5,"Zhanghu",2,"WangLi",6,"LinMin" };
   int  i;
/**********found**********/
   fun(___3___);
   printf("\nThe result is :\n");
   for(i=0; i<3; i++)
      printf("%d,%s\n",std[i].num,std[i].name);
}

⣨ʮ
иУfunĹǣڴͷĵУֵΪchĽ㡣ҵֵͨظý˳ţֵΪchĽ㣬0ֵ
»ߴȷݲ»ɾʹóȷĽ
ע⣺лɾУҲøĳĽṹ
#include <stdio.h>
#include <stdlib.h>
#define N 8
typedef  struct list
{  int  data;
   struct list  *next;
} SLIST;
SLIST *creatlist(char  *);
void outlist(SLIST  *);
int fun( SLIST  *h, char  ch)
{  SLIST  *p;        int  n=0;
   p=h->next;
/**********found**********/
   while(p!=___1___)
   {   n++;
/**********found**********/
       if (p->data==ch)  return ___2___;
       else  p=p->next;
   }
   return 0;
}
main()
{  SLIST  *head;       int  k;      char  ch;
   char  a[N]={'m','p','g','a','w','x','r','d'};
   head=creatlist(a);
   outlist(head);
   printf("Enter a letter:");
   scanf("%c",&ch);
/**********found**********/
   k=fun(___3___);
   if (k==0)   printf("\nNot found!\n");
   else       printf("The sequence number is :  %d\n",k);
}
SLIST *creatlist(char  *a)
{  SLIST  *h,*p,*q;      int  i;
   h=p=(SLIST *)malloc(sizeof(SLIST));
   for(i=0; i<N; i++)
   {  q=(SLIST *)malloc(sizeof(SLIST));
      q->data=a[i];  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("->%c",p->data);  p=p->next;  }
     while(p!=NULL);
     printf("->End\n");
  }
}

⣨ʮģ
УfunĹǽβθַдıļУַʽӴıļ벢ʾնĻϡ 
ڳ»ߴȷݲ»ɾʹóȷĽ
ע⣺Ķmainеκݣںfunĺдɱʽ䡣
#include  <stdio.h>
void fun(char  *s, int  a, double  f)
{
/**********found**********/
  __1__ fp;
  char  ch;
  fp = fopen("file1.txt", "w");
  fprintf(fp, "%s %d %f\n", s, a, f);
  fclose(fp);
  fp = fopen("file1.txt", "r");
  printf("\nThe result :\n");
  ch = fgetc(fp);
/**********found**********/
  while (!feof(__2__)) 
{
/**********found**********/
    putchar(__3__); 
	ch = fgetc(fp);  
}
    putchar('\n');
    fclose(fp);
}
main()
{ char  a[10]="Hello!";  int  b=12345;
  double  c= 98.76;
  fun(a,b,c);
}

⣨ʮ壩
иĹǣúfunָԴļеݸƵָĿļУƳɹʱ1ʧʱ0ڸƵĹУѸƵĻԴļڱsfnameУĿļڱtfnameС
»ߴȷݲ»ɾʹóȷĽ
ע⣺лɾУҲøĳĽṹ
#include <stdio.h>
#include <stdlib.h>
int fun(char  *source, char  *target)
{  FILE  *fs,*ft;      char  ch;
/**********found**********/
   if((fs=fopen(source, ___1___))==NULL)
      return 0;
   if((ft=fopen(target, "w"))==NULL)
      return 0;
   printf("\nThe data in file :\n");
   ch=fgetc(fs);
/**********found**********/
   while(!feof(___2___))
   {  putchar( ch );
/**********found**********/
      fputc(ch,___3___);
      ch=fgetc(fs);
   }
   fclose(fs);  fclose(ft);
   printf("\n");
   return  1;
}
main()
{  char  sfname[20] ="myfile1",tfname[20]="myfile2";
   FILE  *myf; int  i; char  c;
   myf=fopen(sfname,"w");
   printf("\nThe original data :\n");
   for(i=1; i<30; i++){ c='A'+rand()%25;fprintf(myf,"%c",c); printf("%c",c); }
   fclose(myf);printf("\n");
   if (fun(sfname, tfname))  printf("Succeed!");
   else  printf("Fail!");
}

⣨ʮ
УfunĹǣ20ͬβaָ(0)
ڳ»ߴȷݲ»ɾʹóȷĽ
ע⣺лɾУҲøĳĽṹ

#include <stdlib.h>
#include <stdio.h>
#define N 20
void fun(int *a)
{
	int i, x, n=0;
	x=rand()%20;
/**********found**********/
	while (n<__1__)
	{  for(i=0; i<n; i++ )
/**********found**********/
         if( x==a[i] ) 
		    __2__;
/**********found**********/
     if( i==__3__)
	 {a[n]=x; n++; }
	 x=rand()%20;
	}
}
main()
{
	int  x[N]={0} ,i;
	fun( x );
	printf("The result :  \n");
	for( i=0; i<N; i++ )
	{
		printf("%4d",x[i]);
		if((i+1)%5==0)printf("\n");
	}
  printf("\n");
}

⣨ʮߣ
УѸɽṹ幹ɵabcоַfun()ǣabcӳһеݡ
ڳ»ߴȷݲ»ɾʹóȷĽ
ע⣺лɾУҲøĳĽṹ

#include <stdio.h>
typedef struct list
{  char data;
   struct list *next;
} Q;
void fun( Q *pa, Q *pb, Q *pc)
{  Q  *p;
/**********found**********/
   pa->next=___1___;
   pb->next=pc;
   p=pa;
   while( p )
   {
/**********found**********/
      printf("  %c",____2_____);
/**********found**********/
      p=____3____;
   }
   printf("\n");
}
main()
{  Q  a, b, c;
   a.data='E';  b.data='F';  c.data='G';  c.next=NULL;
   fun( &a, &b, &c );
}

⣨ʮˣ
ͨѧṹ洢ѧѧšſεĳɼѧݾԶƷʽļСfunĹǴβfilenameָļжѧݣѧŴСöƷʽѧfilenameָļУԭļݡ
ڳ»ߴȷݲ»ɾʹóȷĽ
ע⣺лɾУҲøĳĽṹ

#include <stdio.h>
#define N 5
typedef struct student {
  long  sno;
  char  name[10];
  float  score[3];} STU;
void fun(char *filename)
{ 
	FILE *fp; int i, j;
	STU  s[N], t;
/**********found**********/
	fp=fopen(filename, __1__);
	fread(s,sizeof(STU),N,fp);
	fclose(fp);
	for (i=0; i<N-1; i++)
	  for (j=i+1; j<N; j++)
		if (s[i].sno __2__ s[j].sno)
		{
			t = s[i];  s[i] = s[j];  s[j] = t;  
		}
			fp=fopen(filename,"wb");
/**********found**********/
	  __3__(s, sizeof(STU), N, fp);
	  fclose(fp);
}
main()
{ STU t[N]={ {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}}, ss[N];
  int  i,j;  FILE  *fp;
  fp = fopen("student.dat", "wb");
  fwrite(t, sizeof(STU), 5, fp);
  fclose(fp);
  printf("\nThe original data :\n");
  for (j=0; j<N; j++)
  {  printf("\nNo: %ld  Name: %-8s      Scores:  ",t[j].sno, t[j].name);
     for (i=0; i<3; i++)  printf("%6.2f ", t[j].score[i]);
     printf("\n");
  }
  fun("student.dat");
  printf("\nThe data after sorting :\n");
  fp = fopen("student.dat", "rb");
  fread(ss, sizeof(STU), 5, fp);
  fclose(fp);
  for (j=0; j<N; j++)
  {  printf("\nNo: %ld  Name: %-8s      Scores:  ",ss[j].sno, ss[j].name);
    for (i=0; i<3; i++)  printf("%6.2f ", ss[j].score[i]);
    printf("\n");
  }
}

⣨ʮţ
funĹǣnԪصĽṹstdУвĿѧҵѧѧţķֵвĿѧ
磬и4ѧݣеĽΪ
ѧţN1002  ѧţN1006
2λѧвĿ
ڳ»ߴȷݣ»ɾʹóȷĽ
ע⣺лɾУҲøĳĽṹ

#include <stdio.h>
typedef struct
{ char num[8];  
  double score[2];
/**********found**********/
} __(1)__ ;
int fun(STU std[ ], int n)
{  int i, k=0;
   for(i=0; i<n; i++)
/**********found**********/
     if( std[i].score[0]<60__(2)__std[i].score[1]<60 ) 
     { k++;printf("ѧţ%s ",std[i].num);}
/**********found**********/
   return __(3)__ ;
}
main()
{  STU std[4]={ "N1001", 76.5,82.0 ,"N1002", 53.5,73.0, 
                "N1005", 80.5,66.0,"N1006", 81.0,56.0 };
  printf( "\n%dλѧвĿ\n" , fun(std,4) );
}


⣨ʮ
ɸѡɵõ2n(n10000)֮ǣȴ2ʼ2ıɾȥ(Ӧλõֵó0)Ŵһ0ɾȥбƣֱҵһnΪֹõһУ2,3,5,7,11,13,17,19,23
funǣɸѡҳСڵnͳĸΪֵء
ڳ»ߴȷݲ»ɾʹóȷĽ
ע⣺лɾУҲøĳĽṹ

#include <stdio.h>
int fun(int n)
{  int a[10000], i,j, count=0;
   for (i=2; i<=n; i++)  a[i] = i;
   i = 2;
   while (i<n)
   {
/**********found**********/
      for (j=a[i]*2; j<=n; j+=___1___)
         a[j] = 0;
	  i++;
/**********found**********/
      while (___2___==0)
         i++;
   }
   printf("\nThe prime number between 2 to %d\n", n);
   for (i=2; i<=n; i++)
/**********found**********/
     if (a[i]!=___3___)
	 {  count++;
	    printf( count%15?"%5d":"\n%5d",a[i]);  
	 }
	 return  count;
}
main()
{  int  n=20, r;
   r = fun(n);
   printf("\nThe number of prime is  :  %d\n", r);
}


























