C++语言开发示例:11. 条件语句
if.cpp
#include <iostream>
int main()
{
using std::cin;
using std::cout;
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";
} 最后更新于1年前
本文由人工编写,AI优化,转载请注明原文地址: C++语言开发示例:11. 条件语句