#include <iostream> #include <string> using namespace std; bool testString (stri
ID: 3614107 • Letter: #
Question
#include <iostream>
#include <string>
using namespace std;
bool testString (string test,string target);
int main()
{
string test, target;
cout<<" Enter aword: ";
cin>> test;
cout<< "Enter anotherword: ";
cin>> target;
if ( testString (test, target))
{
cout<< test <<"is part of" << target;
}
else
{
cout<< test<< "Is NOT part of"<< target;
}
return 0;
}
bool testString (string test,string target)
{
for ( inti = 0; i < target.length();i++)
{
if (test == target [i])
{
return true;
}
}
return false;
}
Explanation / Answer
#include #include using namespace std; bool testString (string test, string target); int main() { string test, target; cout test; cout> target; if ( testString (test, target) ) { coutRelated Questions
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.