入力した文字列を逆から表示するプログラムのソースをオライリーあたりからパクって来てVC++.NETでコンパイル
して、動かそうとしたんですが、表示されるのは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;
      }
}