Answer to Question #264305 in C++ for Amit

Question #264305

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


1
Expert's answer
2021-11-11T07:30:14-0500
#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!

Comments

No comments. Be the first!

Leave a comment

LATEST TUTORIALS
New on Blog
APPROVED BY CLIENTS