编程菜鸟的日记-初学尝试编程-C++ Primer Plus 第5章编程练习8

#include <iostream>
#include <string>
using namespace std;
int main ()
{
 string words;
 int i=0;
 cout<<"Enter words (to stop, type the word done): ";
 (cin>>words).get();
 while(words!="done")
 {
  i++;
  (cin>>words).get();
 }
 cout<<"You entered a total of "<<i<<" words.";
 system("pause");
 return 0;
}

原文地址:https://www.cnblogs.com/lynnycy/p/3450425.html