Please get the code corrected

I am unable to diagnose the error aman sir .

send the link of your code

code ??
not question

#include
#include<bits/stdc++.h>
using namespace std;
int main() {
string str;
getline(cin,str);

char *ptr = strtok(str," ")
cout << ptr<<endl;
while(ptr != null)
{
 ptr = strtok(NULL," ");
 cout<< ptr<<endl;
}
return 0;

}

there is no space in the given string
so this will not work

then what approach can be use sir

you have to use for loop
like this

Can we use UPPERCASE for tokenising the string .Because the word is in camelcase .

NO there is no such functionality
may be you have to make your own custom strtok for that

1 Like

ok sir thanks for the help .

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.

1 Like