#include<iostream>
int main()
{
using namespace std;
char ch;
int spaces = 0;
int total = 0;
cin.get(ch);
while(ch != '.')
{
if(ch == ' ')
++spaces;
++total;
cin.get(ch);
}
cout << spaces << " spaces, " << total;
cout << " characters total in sentence\n";
return 0;
}
Sample 6.1:if.cpp
最新推荐文章于 2024-06-22 22:20:43 发布