![]() |
請問下面的程式要怎麼寫阿??
Write a program of a dice game.
1.The computer and the player are given 100 dollars wager. 2.The player decides the number of dices to roll (It should be larger than 0). 3. The computer and the player roll the dices. 4.Whoever has the larger total is the winer. 5. Whoever wins twice wins a set of game. The winner gains the wager of 20 dollars and the loser looses the wager of 20 dollars. 6. A player can keep playing the game or quit the game. 7. The game is over when the player or the computer looses all the wager. 8.Once the game is over, the player can start a new game or quit the game. A possible run may look like: ************************************************** Welcome to the dice game! ************************************************** Player's wager: 100 Computer's wager: 100 Enter the number of dices to roll (>= 1): 0 Try again! Enter the number of dices to roll: 2 Roll the dice (Push any key to roll)? Player: 3 3 Computer: 2 6 => Computer wins once. Roll the dice (Push any key to roll)? Player: 2 5 Computer: 3 4 => No winner. Try again! Roll the dice (Push any key to roll)? Player: 2 6 Computer: 1 3 => Player wins once. Roll the dice (Push any key to roll)? Player: 4 6 Computer: 3 5 => Player wins the set. Player's wager: 120 Computer's wager: 80 ================================================== Continue (Y/N)? Y Enter the number of dices to roll: 3 Roll the dice (Push any key to roll)? Player: 3 3 6 Computer: 2 6 5 => Computer wins once. ..... ..... Player's wager: 200 Computer's wager: 0 ==================== Game Over! ================== Start a new game (Y/N)? Y .... 這該怎麼寫勒......... 可以給我參考一下嗎 |
語法:
#include<iostream> |
非常感謝你的解答喔!!
很詳細又有註解~~~: 我現在就來試試看.......... 感謝捏 有問題我再問你!!:on_14::on_87: |
引用:
|
引用:
甚麼全國賽阿 這麼厲害 :on_72: |
所有時間均為台北時間。現在的時間是 12:33 PM。 |
Powered by vBulletin® 版本 3.6.8
版權所有 ©2000 - 2025, Jelsoft Enterprises Ltd.
『服務條款』
* 有問題不知道該怎麼解決嗎?請聯絡本站的系統管理員 *