check if character in string c++

#include <iostream>
#include <string>

int main() {
    std::string str = "Hello, World!";
    char ch = 'o';

    if (str.find(ch) != std::string::npos) {
        std::cout << "Character found in the string." << std::endl;
    } else {
        std::cout << "Character not found in the string." << std::endl;
    }

    return 0;
}