Skip to content

Commit a2fa429

Browse files
authored
Add files via upload
1 parent 84ae6ed commit a2fa429

File tree

1 file changed

+48
-7
lines changed

1 file changed

+48
-7
lines changed

toolBag.cpp

Lines changed: 48 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -5,23 +5,64 @@ using namespace std;
55
void 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+
}
1434
int 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

0 commit comments

Comments
 (0)