2 like 0 dislike

設計一個樂透號碼產生程式。首先定義結構 Lotto,裡面包含兩個成員:iNumber為該球的編號,iValue 為該球出現的次數。並以 typedef 的方式將 Lotto 重新命名為 LUCKY,並以 LUCKY 在主程式中宣告結構陣列 lucky[42],也就是樂透球的號碼是編號 1 到 42 號。號碼的產生方式為:先以讓使用者輸入要亂數值行的次數,介於 10000 到 100000 之間。然後以亂數產生器執行指定的次數,每次都是隨機產生 1 到 42 號,產生的號碼就在相對應樂透球的 iValue 上加 1,代表該號碼球出現一次。最後根據每一顆球的 iValue 值加以排序,選出 iValue 值最高的前七位,該七顆球的號碼就是當期的號碼。

 

參考書籍:旗標無痛學習教本

[Normal] Essay (Open question) - asked in Introduction to Computer Programming I (C) by (20.9k points)
Available when: Unlimited - Due to: Unlimited
| 5 views
Get it on Google Play Welcome to Peer-Interaction Programming Learning System (PIPLS) LTLab, National DongHwa University
English 中文 Tiếng Việt
IP:108.162.221.153
©2016-2019

Related questions

2 like 0 dislike
0 answers
[Normal] Essay (Open question) - asked Feb 11, 2017 in Introduction to Computer Programming I (C) by The Contributor (20.9k points)
Available when: Unlimited - Due to: Unlimited
| 2 views
1 like 0 dislike
0 answers
[Normal] Essay (Open question) - asked Feb 11, 2017 in Introduction to Computer Programming I (C) by The Contributor (20.9k points)
Available when: Unlimited - Due to: Unlimited
| 4 views
2 like 0 dislike
0 answers
[Normal] Essay (Open question) - asked Feb 11, 2017 in Introduction to Computer Programming I (C) by The Contributor (20.9k points)
Available when: Unlimited - Due to: Unlimited
| 2 views
2 like 0 dislike
0 answers
[Normal] Essay (Open question) - asked Feb 11, 2017 in Introduction to Computer Programming I (C) by The Contributor (20.9k points)
Available when: Unlimited - Due to: Unlimited
| 2 views
3 like 0 dislike
0 answers
[Normal] Essay (Open question) - asked Feb 19, 2017 in Introduction to Computer Programming I (C) by The Contributor (20.9k points)
Available when: Unlimited - Due to: Unlimited
| 3 views
8,033 questions
60,929 answers
33,033 comments
1,102 users