史萊姆論壇

返回   史萊姆論壇 > 專業主討論區 > 程式語言討論區
忘記密碼?
論壇說明

歡迎您來到『史萊姆論壇』 ^___^

您目前正以訪客的身份瀏覽本論壇,訪客所擁有的權限將受到限制,您可以瀏覽本論壇大部份的版區與文章,但您將無法參與任何討論或是使用私人訊息與其他會員交流。若您希望擁有完整的使用權限,請註冊成為我們的一份子,註冊的程序十分簡單、快速,而且最重要的是--註冊是完全免費的!

請點擊這裡:『註冊成為我們的一份子!』

Google 提供的廣告


發文 回覆
 
主題工具 顯示模式
舊 2007-12-07, 05:37 AM   #1
rang0419
註冊會員
榮譽勳章

勳章總數
UID - 285008
在線等級: 級別:0 | 在線時長:4小時 | 升級還需:1小時
註冊日期: 2007-11-07
文章: 24
精華: 0
現金: 35 金幣
資產: 35 金幣
預設 疑問 - Write a C program to simulate a 6 star lottery game.

請麻煩也用C寫~~~~

也請麻煩加註解.......

給小弟做個參考一下ˊˋ


Write a program to simulate a 6 star lottery game. The rule is as follows:
1.A lottery ticket cost NT $50.
2.The lottery number is from 000000 to 999999.
3.A player can pick 6 numbers from 0 to 9.
4.The game has 4 types of awarding prize:
6 stars: The selected 6 numbers are in the same order as the 6 lottery numbers. - NT $200,000
5 stars: Last 5 numbers are in the same order as the last 5 lottery numbers. - NT $20,000
4 stars: Last 4 numbers are in the same order as the last 4 lottery numbers. - NT $2,000
3 stars: Last 3 numbers are in the same order as the last 3 lottery numbers. - NT $200

The game is going in the follow way:
1.Display a welcome message to the game. A player enters her or his name.
2.A player can select the number of tickets the player wants to buy and decide if the computer selects the numbers or the player selects the numbers.
3.A player enters the numbers or the computer selects the numbers based on the player's decision.
4.Print the receipt.
5.The player can choose to buy more tickets or not.
6.Show the lottery result.
7.Calculate how much the player spends and wins.
8.The player can choose to continue a new game.
9.A possible run could look like as follows:

=================================================
Welcome to the Happy Lottery Game!
Your name: Rita
Rita, welcome to the game!
=================================================
Enter the number of tickets you want to buy: 2
Computer or Player select (C/P)? P
Select numbers: 1 3 7 6 8 0
Select numbers: 6 7 5 4 2 9
-------------------------------------------------
Rita's Receipt:
Total pay: 100
Thanks for your playing Happy Lottery.
=================================================
Play more (Y/N)? Y
=================================================
Enter the number of tickets you want to buy: 1
Computer or Self select (C/P)? P
Select numbers: 2 7 6 3 8 2
-------------------------------------------------
Rita's Receipt:
Total pay: 50
Thanks for your playing Happy Lottery..
=================================================
Play more (Y/N)? N
The lottery result is:
1 2 6 3 8 2
Rita! Congratulations! You won 3 stars.
You spent NT $150 and won NT $200.
=================================================
Quit the game (Y/N)? N
=================================================
Welcome to the lottery game!
Your name: Mary
Rita, welcome to the game!
=================================================
...
...
=================================================
Quit the game (Y/N)? Y
=================================================
Thanks for playing!
rang0419 目前離線  
送花文章: 5, 收花文章: 0 篇, 收花: 0 次
回覆時引用此帖
發文 回覆



發表規則
不可以發文
不可以回覆主題
不可以上傳附加檔案
不可以編輯您的文章

論壇啟用 BB 語法
論壇啟用 表情符號
論壇啟用 [IMG] 語法
論壇禁用 HTML 語法
Trackbacks are 禁用
Pingbacks are 禁用
Refbacks are 禁用


所有時間均為台北時間。現在的時間是 08:40 AM


Powered by vBulletin® 版本 3.6.8
版權所有 ©2000 - 2024, Jelsoft Enterprises Ltd.


SEO by vBSEO 3.6.1