捕获一个int变量, 判断是否…

int main(int argc, char **argv)
{
    int i;
    cout << "Input the start number: ";
    cin >> i;
    auto if_equal_zero = [&]()-> bool{
        if (i == 0)
            return true;
        else
            while (i > 0)
                --i;
        return false; };
    cout << (([&]()-> bool{
        if (i == 0)
            return true;
        else
            while (i > 0)
                --i;
        return false; })()? "The number equal 0" : "The number is not equal 0") << endl;
    cout << endl;
    return 0;
}

posted @ 2014-07-18 21:07  wu_overflow  阅读(152)  评论(0编辑  收藏  举报