Finding characters in strings

Hello guys i'm new to this forum and to programming in general. So for school I'm supposed to compile a program that takes a user input into a string, and then the program is supposed to find wether the user input contains the word "apples" inside the inputted string in seperate letters. For example, if the user inputs "alex and sandy primarily prefer to become politicians over a lawyers" the program is supposed to output that "apples are present in this sentence" since a(a)lex and sandy p(p)refer to become p(p)oliticians over l(l)awye(e)rs(s). However, if the user inputs something like "I love basketball", the output should be "apples are not present in this sentence". Being extremely new to the world of programming, I was wondering if there is a specific function that could detect desired letters within a user-input?
If you are speaking about standard class std::string then you can use member function find or find_first_of.
If you are speaking about character arrays then you can use coreesponding standard algorithm std::find and std::find_first_of.
Or you can use standard C functions as for example strchr or strcspn.
Topic archived. No new replies allowed.