当前位置: 首页>>代码示例>>C++>>正文


C++ set::show方法代码示例

本文整理汇总了C++中set::show方法的典型用法代码示例。如果您正苦于以下问题:C++ set::show方法的具体用法?C++ set::show怎么用?C++ set::show使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在set的用法示例。


在下文中一共展示了set::show方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: main

int main()
{
    //set up a timer and seed the random and create the decks and hands
    Timer clock;
    srand(time(NULL));
    vector<int> deck(52*deckCount);
    vector<int> copy(52*deckCount);
    Dhand dealer;
    Phand player;
    
    //initialize the decks by loading in 
    initDeck(deck);
    initDeck(copy);   
    
    char temp;
    
    while(true)
    {
        cout << "What would you like to do? ((s)how, (p)lay), (l)earn: ";
        cin >> temp;
        switch(temp)
        {
            //this section is for if a human player wishes to play a single game, but havent gotten a chance to implement the play function yet, so play currently does not do much.
            /*case 'p':
                initDeck(deck);
                shuffle(deck);
                    
                deal(dealer, player, deck);
                
                board(dealer, player);
                play(dealer, player, deck, false);
                
                cout <<  endl << "========================" << endl << "      NEW GAME" << endl << "========================" << endl;
                break; */
            case 'l':
                /*runs a timer to see how quickly Runs amount takes for debugging issues.
                  this section first copies the original deck to a temp copy and shuffles it
                  as reinitializing the deck every time was too slow. It then loops through run times
                  in order to simulate that many games played. */
                wins = 0;
                clock.start();
                for(long long int x=0; x<RUNS; x++)
                {
                    copy = deck;
                    shuffle(copy);
                    
                    deal(dealer, player, copy);
                    if(learn(dealer, player, copy, false))
                    {
                        wins++;
                    }
                }
                clock.stop();
                cout << clock.getElapsedTime() << endl;
                cout << "won: " << (wins/RUNS)*100 << "%" << endl;
                break;
            case 's':
                info.show();
                break;
        }
    }
    
    return 0;
}
开发者ID:BigMacStorm,项目名称:BlackJack,代码行数:64,代码来源:blackjack.cpp


注:本文中的set::show方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。