Smart keypad doubt

whats the problem in this code
#include
#include
using namespace std;
void printKeyPadStirng(char ip[],char op[],int i,int j){
string table[] = { " ", “.+@$”, “abc”, “def”, “ghi”, “jkl” , “mno”, “pqrs” , “tuv”, “wxyz” };
if(ip[i]==’\0’){
op[j]=’\0’;
cout<<op<<endl;
return;
}
int digit=ip[i]-‘0’;
for(int k=0;k<table[i].length();k++){
op[j]=table[digit][k];
printKeyPadStirng(ip,op,i+1,j+1);

}

}
int main() {
char ip[1000];
char op[20];

cin>>ip;


 printKeyPadStirng(ip,op,0,0);
return 0;

}

Hi @deepakjumani09
here is d updated code.


in
for(int k=0;k<table[i].length();k++){
use table[digit] instead of table[i].
hope ds helps

I hope I’ve cleared your doubt. I ask you to please rate your experience here
Your feedback is very important. It helps us improve our platform and hence provide you
the learning experience you deserve.

On the off chance, you still have some questions or not find the answers satisfactory, you may reopen
the doubt.