c primer plus 6.1
代码语言:javascript
复制 char ch;
int spaces=0;
int total=0;
cin.get(ch);
// while(cin.get(ch)!='.'){
while(ch!='.'){
if(ch==' '){
spaces ;
}
total ;
cin.get(ch);
}
cout<<spaces<<"spaces"<<total;
cout<<"characters total in sentencen"<<endl;