C++基础 —— (23)C++14 循环语句
»
    for-loop:
    ------------------------------------------------------------------
    for(int i=0;i<100;i++){
        std::cout<<i<<" ";
    }
    std::cout<<std::endl;
    ------------------------------------------------------------------


    for-each-loop:
    ------------------------------------------------------------------
    for(auto &item:vectorVal){
        std::cout<<item<<std::endl;
    }

    for(auto& pair:mapVal){
        std::cout<<pair.first<<" "<<pair.second<<std::endl;
    }
    ------------------------------------------------------------------

    while-loop
    ------------------------------------------------------------------
    while(true){
        std::cout<<"looping"<<std::endl;
        if(needExitLoop){
            break;
        }
    }
    ------------------------------------------------------------------

    do-while-loop
    ------------------------------------------------------------------
    int count=1;
    do{
        std::count<<"count::::"<<count<<endl;
        --count;
    }while(count>0);
    ------------------------------------------------------------------
«
——张人杰·www.v-signon.com学习者共勉
返回上一页
备案号:京ICP备19038994号-2
个人作品网站:www.up-task.com 主办:个人 English
网站内容如有侵权,请联系删除:1307776259@qq.com