#include<stdio.h>
#include<string.h>
#include<string.h>
//使用下标
char * find_char_with_sub ( char const * source , char const * chars )
{
char
*
vp
;
int
i
,
flag
=
0
;
for
(
vp
=&
source
[
0
];
vp
<&
source
[
strlen
(
source
)];
vp
++
)
{
i
=
0
;
for
(
i
=
0
;
i
<
strlen
(
chars
);
i
++
)
if
(
chars
[
i
]
==*
vp
)
{
flag
=
1
;
break
;
}
if
(
flag
==
1
)
break
;
}
return
vp
;
}
char * find_char_with_sub ( char const * source , char const * chars )
{
}
//不使用小标啊
char * find_char_without_sub ( char const * source , char const * chars )
{
char
*
vp
;
int
i
,
flag
=
0
;
for
(
vp
=
source
;
*
vp
!=
'\0'
;
vp
++
)
{
i
=
0
;
for
(
i
=
0
;
i
<
strlen
(
chars
);
i
++
)
if
(
*
(
chars
+
i
)
==*
vp
)
{
flag
=
1
;
break
;
}
if
(
flag
==
1
)
break
;
}
return
vp
;
}
int main ()
{
char
source
[
100
];
char
chars
[
100
];
gets
(
source
);
gets
(
chars
);
printf
(
"strpbrk,output:%c
\n
"
,
*
strpbrk
(
source
,
chars
));
printf
(
"mywork,output:%c
\n
"
,
*
find_char_with_sub
(
source
,
chars
));
printf
(
"mywork,output:%c"
,
*
find_char_without_sub
(
source
,
chars
));
return
0
;
}
char * find_char_without_sub ( char const * source , char const * chars )
{
}
int main ()
{
}