您的位置:首页 > 其它

找出一个字符串中所有的元音字母

2017-11-22 21:55 330 查看
int main()
{
char sentence[] = "Wangye is a handsome boy!";
char Vowels[] = "aeiou";
char* pch = NULL;
printf("Vowels in '%s': ", sentence);

pch = strpbrk(sentence, Vowels);//这里用了strpbrk函数

while (pch != NULL)
{
printf("%c ", *pch);
pch = strpbrk(pch + 1, Vowels);
}
printf("\n");

system("pause");
return 0;
}




strpbrk

函数原型:char* strpbrk( const char*, const char* );

注释:Returns a pointer to the first occurrence in str1 of any of the characters that are part of str2, or a null pointer if there are no matches.

返回第一个字符串中第一个出现在第二个字符串中的字符的地址
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: 
相关文章推荐