pr05007.cpp

来自「c++编程宝典源码及Quincy99编译器 是《标准C++编程宝典》电子工业出」· C++ 代码 · 共 33 行

CPP
33
字号
////////////////////////////////////////
// File Name: pr05007.cpp
////////////////////////////////////////
#include <iostream>

// Function prototype.
int Gather();

////////////////////////////////////////
// The main() function.
////////////////////////////////////////
int main()
{
    int gwool = 0;
    while (gwool < 60)
    {
        gwool = Gather();
        std::cout << gwool << std::endl;
    }
}

////////////////////////////////////////
// Return the current value of the wool
// static variable.
////////////////////////////////////////
int Gather()
{
    // A static local variable.
    static int wool = 50;

    return ++wool;
}

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?