【初心者歓迎】C/C++室 Ver.9【環境依存OK】
■ このスレッドは過去ログ倉庫に格納されています
0351デフォルトの名無しさん
NGNGして、動かそうとしたんですが、表示されるのは1行目だけで、しかも止まりません。
どうすればいいでしょうか?
#include<iostream>
#include<string>
using namespace std;
int main(int argc,char** argv){
const string delims("\t,.;");
string line;
while(getline(cin,line)){
string::size_type begIdx,endIdx;
begIdx=line.find_first_not_of(delims);
while(begIdx!=string::npos){
endIdx=line.find_first_of(delims,begIdx);
if(endIdx==string::npos){
endIdx=line.length();
}
for(int i=endIdx-1;i>=static_cast<int>(begIdx);--i){
cout<<line[i];
}
cout<<' ';
begIdx=line.find_first_not_of(delims,begIdx);
}
cout<<endl;
}
}
■ このスレッドは過去ログ倉庫に格納されています