精品偷拍一区二区三区,亚洲精品永久 码,亚洲综合日韩精品欧美国产,亚洲国产日韩a在线亚洲

  • <center id="usuqs"></center>
  • 
    
  • 請(qǐng)達(dá)人幫我寫(xiě)一個(gè) silly board game 的程序

    請(qǐng)達(dá)人幫我寫(xiě)一個(gè) silly board game 的程序
    Nancy’s Silly board game is a spectator game and is based on luck.
    1.The board has 25 squares numbered 1
    to 25.
    2.The first of two players to land on square/box number 25 wins the game.The players start off the
    board (equivalent to position 0).
    3.Each player rolls 2 dice which tells them the number of squares/boxes to move,and flips a coin to determine the direction in which they move:heads player moves forward,tails
    player moves backwards.
    比如:到了第23格,必須只能投出2點(diǎn)才能到打25,如果大于兩點(diǎn),保持不動(dòng),其他情況相同
    在0格時(shí),如果硬幣投出反面,將保持不動(dòng),因?yàn)闆](méi)有負(fù)格
    程序是這樣執(zhí)行的:
    player1 is at box # 7(7) player2 is at box # 0(-12)
    player1 is at box # 0(-8) player2 is at box # 0(-10)
    player1 is at box # 0(-7) player2 is at box # 8(8)
    player1 is at box # 7(7) player2 is at box # 1(-7)
    player1 is at box # 0(-7) player2 is at box # 0(-8)
    player1 is at box # 10(10) player2 is at box # 0(-4)
    player1 is at box # 17(7) player2 is at box # 0(-12)
    player1 is at box # 25(8) *** winner!
    player1 is at square #25
    player2 is at square #0
    題目要求需要用function
    即硬幣正反面,和兩個(gè)篩子的總數(shù)都要用function
    其他人氣:744 ℃時(shí)間:2020-05-21 03:16:42
    優(yōu)質(zhì)解答
    #include
    #include
    #include
    #include
    #include
    using namespace std;
    int GenerateDice();
    int GenerateDirect();
    int GetNextPos( int curPos,int direct,int dice);
    int main()
    {
    int dice1,dice2,direct1,direct2,squa1=0,squa2=0,d1,d2,pos1,pos2;
    srand(time(0));
    cout
    我來(lái)回答
    類(lèi)似推薦
    請(qǐng)使用1024x768 IE6.0或更高版本瀏覽器瀏覽本站點(diǎn),以保證最佳閱讀效果。本頁(yè)提供作業(yè)小助手,一起搜作業(yè)以及作業(yè)好幫手最新版!
    版權(quán)所有 CopyRight © 2012-2024 作業(yè)小助手 All Rights Reserved. 手機(jī)版