#include<iostream>
#include<math.h>
#include<string>
//#include <array>
using namespace std;
void main()
{
<span style="white-space:pre"> </span>string str ;
<span style="white-space:pre"> </span>string t="done";
<span style="white-space:pre"> </span>int n=0;
<span style="white-space:pre"> </span>cout<<"Enter words (to stop,type the word done)"<<endl;
<span style="white-space:pre"> </span>cin>>str;
<span style="white-space:pre"> </span>while(str!=t)
<span style="white-space:pre"> </span>{
<span style="white-space:pre"> </span>n++;
<span style="white-space:pre"> </span>cin>>str;
<span style="white-space:pre"> </span>cin.get();
<span style="white-space:pre"> </span>}
<span style="white-space:pre"> </span>cout<<"You enter a total of "<<n<<" words.";
}
C++primer plus第六版课后编程练习答案5.9
最新推荐文章于 2021-08-25 09:43:12 发布