Question #264305

Searching a word present in a sentence or not, if present print its location with a successful note.


Expert's answer

#include <iostream>
#include <cstring>
using namespace std;


int  main(){
        string str="I am a C++ Programmer";
        string str1="am";
        //int x=find_str(str,str1);
        cout<<"x\n";
         void find_str(string main,string search) {


        int i;
        int x=find_str(str,str1);
        int found=-1;


        string s=main.split(" ");
        for(i=0;i<s.length;i++)
        {
            if(search.equals(s[i]))
            found=i+1;
        }
        return found;
    };
}

Need a fast expert's response?

Submit order

and get a quick answer at the best price

for any assignment or question with DETAILED EXPLANATIONS!

LATEST TUTORIALS
APPROVED BY CLIENTS