【发布时间】:2011-05-02 21:24:39
【问题描述】:
如何使用 find 函数在 char 数组中查找 char?如果我只是循环元音,那么我本可以得到答案,但我被要求使用 std::find.. 谢谢。
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;
}
【问题讨论】: