Smart keypad advanced

what is the mistake in my code

hello @coderajay03
the syntax for using find is not correct.

image

correct the highlighted portion

can you please give a suggestion for it that how to check if a string is substring of other without writing long code

you r doing in correct way.

just u need to correct the syntax.

ur code is not long . it is fine

no any function to find substring

yeah substr function is there.
check it out

suggest me the change I cant find way out comment whatever you fix

@coderajay03

check this out->

#include <iostream>
#include <string>  // u were importing c string but we want c++
using namespace std;

void results(string *t,string s,string input,string *searchin){ // u need to pass searchin as pointer
    if(s[0]=='\0'){

        for(int i=0;i<=11;i++){              // size is 11 , u cannot use size function here
             size_t found=searchin[i].find(input);
            if(found!=string::npos)
                cout<<searchin[i]<<endl;
        }
        return;
    }
    int r=s[0]-'0';
    for(int k=0;k<t[r].size();k++){
        input+=t[r][k];
        results(t,s.substr(1),input,searchin);
        input.pop_back();
    }
}


int main()
{  string table[]= { " ", ".+@$", "abc", "def", "ghi", "jkl" , "mno", "pqrs" , "tuv", "wxyz" };
  string searchin[] = {
            "prateek", "sneha", "deepak", "arnav", "shikha", "palak",
            "utkarsh", "divyam", "vidhi", "sparsh", "akku"
    };
  string s;
  cin>>s;
  string input="";
  results(table,s,input,searchin);
}