File tree Expand file tree Collapse file tree 1 file changed +48
-7
lines changed Expand file tree Collapse file tree 1 file changed +48
-7
lines changed Original file line number Diff line number Diff line change @@ -5,23 +5,64 @@ using namespace std;
55void lotteryGen (){
66 int num[5 ];
77 srand (time (0 ));
8-
8+
9+ cout << " Your winning numbers are:" ;
910 for (int i=0 ; i<5 ;i++){
10- num[i] = rand ()%100 ; cout << num[i] << ' ' ;
11+ num[i] = rand ()%100 ;
12+ cout << num[i] << ' ' ;
1113 }
1214 return ;
1315}
16+ void d20 (){
17+ int output;
18+ srand (time (0 ));
19+
20+ output = rand ()%20 ;
21+ cout << " You have rolled:" << output << " \n " ;
22+
23+ return ;
24+ }
25+ void d6 (){
26+ int output;
27+ srand (time (0 ));
28+
29+ output = rand ()%6 ;
30+ cout << " You have rolled:" << output << " \n " ;
31+
32+ return ;
33+ }
1434int main (){
15- string select;
35+ int select;
1636 cout << " ***** Welcome to the Tool Bag *****\n " ;
1737 cout << " ***** Please select a tool to use *****\n " ;
1838 cout << " ** 1.Lottery Number Generator **\n " ;
39+ cout << " ** 2.d20 Roll **\n " ;
40+ cout << " ** 3.d6 Roll **\n " ;
41+ cout << " ** 99. To Exit the Program **\n " ;
1942 cin >> select;
20- if (select == " 1" ){
43+
44+ switch (select){
45+
46+ case 1 :
2147 lotteryGen ();
22- }
23- else {
24- cout << " Please select a tool." ;
48+ break ;
49+
50+ case 2 :
51+ d20 ();
52+ break ;
53+
54+ case 3 :
55+ d6 ();
56+ break ;
57+
58+ case 99 :
59+
60+ break ;
61+
62+ default :
63+ cout << " Please make a valid selection.\n " ;
64+ cout << " \n " ;
65+ main ();
2566 }
2667 return 0 ;
2768
You can’t perform that action at this time.
0 commit comments