C++ Primer Plus--分支语句和逻辑运算符(六)

C++提供了if和switch语句来进行决策,还有逻辑运算符和条件运算符。 6.1 if语句 使用if语句来统计语句中的空格总数,实现如下: if.cpp #include <iostream> using namespace std; int main() { char ch; int spaces = 0; int total = 0; cin.get(ch); while (ch
相关文章
相关标签/搜索