CODE MISFUNCTION (CANT FIND ERRORS) (code for getting keys strings)

#include
#include<string.h>
#include
#include
string strtok_key(string s, int key)
{char ch=strtok((char)s.c_str()," “);
while(key>1)
{ch=strtok(NULL,” ");
key–;
}
return (string)ch;
}
int main()
{string a[110];
int n;
cout<<“ENTER NUMBER OF STRINGS”;
cin>>n;
cin.get();
int i=0;

int key;

cin>>key;
while(i<n)
{getline(cin,a[i]);
cout<<strtok_key(a[i],key)<<endl;
i++;
}
return 0;
}

Hey Dhruv , please use ide.codingblocsk.com to share your code

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.