#include <iostream>
#include <string.h>
using namespace std;
int main( void ){
char string[] ="An apple a day keep doctor away";
char seps[] = " ";
char *token;
cout << string << endl << "以空白字元切割字串後:"<<endl;
token = strtok( string, seps );
while( token != NULL ){
cout << token <<endl;
token = strtok( NULL, seps );
}
}
#include <string.h>
using namespace std;
int main( void ){
char string[] ="An apple a day keep doctor away";
char seps[] = " ";
char *token;
cout << string << endl << "以空白字元切割字串後:"<<endl;
token = strtok( string, seps );
while( token != NULL ){
cout << token <<endl;
token = strtok( NULL, seps );
}
}