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
相關文章
相關標籤/搜索