-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathdice.cpp
52 lines (43 loc) · 1.08 KB
/
dice.cpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
#include<iostream>
#include <time.h>
#include <stdlib.h>
#include<windows.h>
using namespace std;
int main()
{
//Get seed value
unsigned seed = time(0);
//Variables
srand(seed);
int count;
int one;
int two;
int three;
int four;
int five;
int six;
//Generate random numbers
for (count = 1; count >= 1; count++)
{ Sleep(2000);
one = rand() % 6 + 1;
two = rand() % 6 + 1;
three = rand() % 6 + 1;
four = rand() % 6 + 1;
five = rand() % 6 + 1;
six = rand() % 6 + 1;
cout<<one<<two<<three<<four<<five<<six<<endl;
if (one == 1 && two == 2 && three == 3 && four == 4 && five == 5 && six == 6)
{
cout << one << "\n";
cout << two << "\n";
cout << three << "\n";
cout << four << "\n";
cout << five << "\n";
cout << six << "\n";
break;
}
}
cout << endl;
cout << "It took" << count << " rolls to roll 1, 2, 3, 4, 5 & 6." << endl;
return 0;
}