首页 > > > strkon 为啥会舍弃第一个字符呢?
#include <iostream>
#include<fstream>
#include <cstring>
using namespace std;
int main()
{
char num[20];
while((cin.get()!='\n')&&cin.getline(num,20,'\n'))
{
char *p=strtok(num," ");
while(p!=NULL)
{
cout<<*p<<endl;
p=strtok(NULL," ");
}
}
}
比如我输入 as de
输出的是 s
de
a 没了来自 “ ITPUB博客 ” ,链接:https://blog.itpub.net/4547/viewspace-3170318/ ,如需转载,请注明出处,否则将追究法律责任。