#include<string.h>
#include<string.h>
int Read_array(char *str,char check_ch);
int main(void)
{
char *ptr="what are you doing ?";
char ch;
printf("请输入字符\n");
while((ch=getchar())!=‘#‘)
{
if(Read_array(ptr,ch ))
printf("%c is in charater string %s\n ",ch,ptr);
else
printf(" %c is not in charater string %s \n ",ch,ptr);
printf("请输入字符\n");
while((ch=getchar())!=‘\n‘)
continue;
}
return 0;
}
int Read_array(char *str ,char check_ch)
{
int i ;
for(i=0;i<strlen(str);i++)
if(*(str+i)==check_ch)
return 1;
return 0;
}
`
时间: 2024-11-06 02:45:52