CJCoding With Joseph
15free / daySign inCreate account

Check Membership with count

Write a function bool contains(const set<int>& s, int x) that returns true if x is stored in the set s and false otherwise. Use s.count(x).

The test prints found when your function returns true and not found when it returns false.

Do NOT write a main function.

Expected Output:

found
not found

= newline. The output ends with a newline — print one after the last line.

Hints2 available
Topics:
STL ContainersSets
1
Tab to indent (Esc then Tab to move on) · Ctrl+Enter to run · Shift+Alt+F to format · Ctrl+Space to expand shortcuts (cout, fori)

Your Output

Run your code to see the output here...

Test Cases

Run your code to see test case results.