大哥大姐帮下忙,急用,望好心人,明晚9点之前帮我搞定
#include <stdio.h>#define M 5
#define N 20
/**********found**********/
int fun(char (*ss) ___1___, int *n)
{ int i, k=0, len=0;
for(i=0; i<M; i++)
{ len=strlen(ss[i]);
/**********found**********/
if(i==0) *n=___2___;
if(len>*n) {
/**********found**********/
___3___;
k=i;
}
}
return(k);
}
main()
{ char ss[M][N]={"shanghai","guangzhou","beijing","tianjing","cchongqing"};
int n,k,i;
printf("\nThe original strings are :\n");
for(i=0;i<M;i++)puts(ss[i]);
k=fun(ss,&n);
printf("\nThe length of longest string is : %d\n",n);
printf("\nThe longest string is : %s\n",ss[k]);
}
#include <stdio.h>
double fun( int m )
{
double t = 1.0;
int i;
for( i = 2; i <= m; i++ )
/**********found**********/
t += 1.0/k;
/**********found**********/
________
}
main()
{
int m;
printf( "\nPlease enter 1 integer number:" );
scanf( "%d", &m );
printf( "\nThe result is %lf\n", fun( m ) );
}
#include <stdio.h>
#include <string.h>
int fun(char *str,char *substr)
{
}
main()
{
char str[81],substr[3];
int n;
printf("输入主字符串: ");
gets(str);
printf("输入子字符串: ");
gets(substr);
puts(str);
puts(substr);
n=fun(str,substr);
printf("n=%d\n",n);
NONO();
}
NONO()
{
/* 请在此函数内打开文件,输入测试数据,调用 fun 函数,
输出数据,关闭文件。 */
char str[81],substr[3], ch;
int n,len, i = 0;
FILE *rf, *wf ;
rf = fopen("K:\\b203\\24000426\\in.dat","r") ;
wf = fopen("K:\\b203\\24000426\\out.dat","w") ;
while(i < 5) {
fgets(str, 80, rf) ;
fgets(substr, 10, rf) ;
len = strlen(substr) - 1 ;
ch = substr[len] ;
if(ch == '\n' || ch == 0x1a) substr[len] = 0 ;
n=fun(str,substr);
fprintf(wf, "%d\n", n) ;
i++ ;
}
fclose(rf) ;
fclose(wf) ;
}