如何使用find函数查找char数组中的char?如果我只是为了循环元音,那么我可以得到答案,但我被要求使用std :: find ..谢谢。C++如何使用find函数查找char数组中的char?
bool IsVowel (char c) {
char vowel[] = {'a', 'e', 'i', 'o', 'u'};
bool rtn = std::find(vowel, vowel + 5, c);
std::cout << " Trace : " << c << " " << rtn << endl;
return rtn;
}
太棒了。很酷..非常感谢... – 2010-10-30 19:16:36