标签:
1.strtok将字符串中的单词用‘ ‘分割出来
#include<iostream> #include<cstdio> #include<cstdlib> #include<cstring> #include<fstream> using namespace std; int main() { /* fstream fin("input.txt",ios::in); fin>>value fstream fin("output.txt",ios::out); fin<<value */ char p[]="i am a student, you are a student too."; char *s=strtok(p," "); while(s!=NULL) { cout<<s<<endl; s=strtok(NULL," "); } return 0; }
输出结果:
标签:
原文地址:http://www.cnblogs.com/program-ccc/p/4782108.html