/************************************
Write a program that reads in a char
target and a string test and tells the
user whether target was in test.
************************************/#include <iostream>#include <string>usingnamespacestd;boolin(charc, strings);intmain(){// Get targer char and test stringchartarget;stringtest;cout<<"Enter target char: ";cin>>target;cout<<"Enter test string: ";cin>>test;// Print whether target in testcout<<"Character "<<target<<" is ";if(!in(target,test))cout<<"not ";cout<<"in string "<<test<<endl;return0;}// in(c,s) is a predicate that returns// true if c is in s, and false otherwise.// notice how it makes use of short-circuit// evaluation, and boolean expressions!boolin(charc, strings){intN=s.length(), i=0;while(i<N&&s[i]!=c)i++;returni<N;}