利用C++匿名函数跳出多重循环

/*
    @Author: wchhlbt
    @Date:   2017/7/26
*/
#include <bits/stdc++.h>

#define Fori(x) for(int i=0;i<x;i++)
#define Forj(x) for(int j=0;j<x;j++)
#define maxn 10005
#define inf 0x3f3f3f3f
#define ONES(x) __builtin_popcount(x)
#define pb push_back
#define _  << "  " <<
using namespace std;

typedef long long ll ;
const double eps =1e-8;
const int mod = 1000000007;
typedef pair<int, int> P;
const double PI = acos(-1.0);
int dx[4] = {0,0,1,-1};
int dy[4] = {1,-1,0,0};

int n,m;
int ans;
int cnt;



int main()
{
    //freopen("test.txt","r",stdin);
    int i,j,k;
    vector<int> a = {8,10, 7, 2,3};
    sort(a.begin(),a.end(), [](int a, int b){
            return a>b;
         });
    for(auto v: a)
        cout << v << endl;

    [&]()  {
        //cout << cnt << endl;
        for(i = 0; i<50; i++){
            for(j = 0; j<50; j++){
                for(k = 0; k<60; k++){
                    if(j==34 && k==37)
                        return ;
                }
            }
        }
    }();
    cout << i _ j _ k <<endl;
    return 0;
}

/*

unsigned   int   0~4294967295
int   2147483648~2147483647
unsigned long 0~4294967295
long   2147483648~2147483647
long long的最大值:9223372036854775807
long long的最小值:-9223372036854775808
unsigned long long的最大值:18446744073709551615

__int64的最大值:9223372036854775807
__int64的最小值:-9223372036854775808
unsigned __int64的最大值:18446744073709551615

*/

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值