c++ primer plus 6.1

2023-07-08 14:55:07 浏览数 (1)

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;

0 人点赞