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

#include <iostream>
#include <cstring>
const MAXSIZE=100;
using namespace std;
int main ()
{
 char words[MAXSIZE];
 int i=0;
 cout<<"Enter words (to stop, type the word done):\n";
 (cin>>words).get();
 while(strcmp(words,"done"))
 {
  i++;
  (cin>>words).get();
 }
 cout<<"You entered a total of "<<i<<" words.";
 system("pause");
 return 0;
}

posted @ 2013-11-29 22:38  编程的爬行者  阅读(142)  评论(0编辑  收藏  举报