I think you should be misunderstanding, or else it is my fault. i suppose to post my coding and lets you all expertise and checking the error for me. However, the system now is workable for space. one more question is if i would like to get some particular word, lets say 3rd word from the sentence. then what should i add inside? the following is the coding: #include using std::cout; using std::endl; using std::cin; #include int main() { char string[256]; char *tokenPtr; cout << "Enter sentence\n"; cin.getline(string,sizeof(string),'\n'); cout << "The string to be tokenized is:\n" << string << "\n\nThe tokens are:\n"; tokenPtr = strtok( string, " " ); while ( tokenPtr != NULL ) { cout << tokenPtr << '\n'; tokenPtr = strtok( NULL, " " ); } return 0; }
W
wey_horng
@wey_horng
Posts
-
how to recognize word from sentence? -
how to recognize word from sentence?can i have a example full source code?
-
how to recognize word from sentence?i try to recognize by using space, but unsuccess. it might be the coding error. can someone pls show me the coding.thanks. ur reponse will be appreciated for me.