while.cpp
来自「24学时攻克C++光盘源代码 深入浅出 方便实用」· C++ 代码 · 共 18 行
CPP
18 行
// Listing 6.1
// Looping with while
#include <iostream>
int main()
{
int counter = 0; // initialize the condition
while(counter < 5) // test condition still true
{
counter++; // body of the loop
std::cout << "counter: " << counter << "\n";
}
std::cout << "Complete. counter: " << counter << ".\n";
return 0;
}
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?