c语言中,调用find函数找出一句话中the的个数,下面是一个填空题.

发布网友 发布时间:2022-04-24 02:10

我来回答

1个回答

热心网友 时间:2023-10-21 03:30

#include <stdio.h>

int find(char *str)

{

 char *fstr="the";

 int i=0,j,n=0;

 while (str[i]!='\0')

 {

 for(j=0;j<2;j++)

 if (str[j+i]!=fstr[j]) break;

 if (str[j+i]==fstr[j]) n++;

 i++;

 }

 return n;

}

 

void main()

{  char a[80];

   gets(a);

   printf("%d",find(a));

 }

 

 

热心网友 时间:2023-11-12 04:28

#include <stdio.h>

int find(char *str)

{

 char *fstr="the";

 int i=0,j,n=0;

 while (str[i]!='\0')

 {

 for(j=0;j<2;j++)

 if (str[j+i]!=fstr[j]) break;

 if (str[j+i]==fstr[j]) n++;

 i++;

 }

 return n;

}

 

void main()

{  char a[80];

   gets(a);

   printf("%d",find(a));

 }

 

 

热心网友 时间:2023-10-21 03:30

#include <stdio.h>

int find(char *str)

{

 char *fstr="the";

 int i=0,j,n=0;

 while (str[i]!='\0')

 {

 for(j=0;j<2;j++)

 if (str[j+i]!=fstr[j]) break;

 if (str[j+i]==fstr[j]) n++;

 i++;

 }

 return n;

}

 

void main()

{  char a[80];

   gets(a);

   printf("%d",find(a));

 }

 

 

热心网友 时间:2023-10-21 03:30

#include <stdio.h>

int find(char *str)

{

 char *fstr="the";

 int i=0,j,n=0;

 while (str[i]!='\0')

 {

 for(j=0;j<2;j++)

 if (str[j+i]!=fstr[j]) break;

 if (str[j+i]==fstr[j]) n++;

 i++;

 }

 return n;

}

 

void main()

{  char a[80];

   gets(a);

   printf("%d",find(a));

 }

 

 

声明声明:本网页内容为用户发布,旨在传播知识,不代表本网认同其观点,若有侵权等问题请及时与本网联系,我们将在第一时间删除处理。E-MAIL:11247931@qq.com