# include <iostream>
# include <string>
using namespace std;
int main()
{
string str1;
string str2 = "done";
int count = 0;
cout<<"Enter words (to stop, type the word done):\n";
while (str1 != str2)
{
cin>>str1;
++count;
}
cout<<"You entered a total of "<<count-1<<" words.\n";
return 0 ;
}
C++Primer.plus第五章5.9编程练习第8题
最新推荐文章于 2024-07-13 19:27:27 发布