#include<stdio.h>
#include<string.h>
//01定义函数查找字符串里是否有指定字符
/*int isHaschar(char a[],char b);
int main(){
char c[]="shuangyuanketang";
printf("%d\n",isHaschar(c,'q'));
}
int isHaschar(char a[],char b){
int result=0;
for (int i=0; i<strlen(a); i++) {
if (a[1]==b) {
return 1;
}
}
return 0;
}*/
//----------------------------------------------------------------------
int isHaschar(char a[],char b);
int isHaschar(char a[],char b){
int result=1;
for (int i=0; i<strlen(a); i++) {
if (a[1]==b) {
result=1;
break;
}
}
return result;
}
int main(){
char c[]="shaungyuanketang";
printf("%d\n",isHaschar(c,'q'));
return 0;
}
|
|