且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

C ++比较字符串和字符串数组

更新时间:2022-06-23 05:29:31

使用查找:

#include <algorithm>
#include <iterator>

auto it = std::find(std::begin(food), std::end(food), word);

if (it != std::end(food))
{
    // found *it
}
else
{
    // not found
}