Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include<iostream>
- #include<cstdlib>
- #include<ctime>
- using namespace std;
- int main()
- {
- srand(time(0));
- bool birthday [365] = {false};
- bool done = false;
- int count = 0;
- while (!done) {
- int next = rand() % 365;
- count++;
- if (birthday[next] == false)
- birthday[next] = true;
- else
- done = true;
- }
- cout << "Count: " << count << endl;
- }
Advertisement
Add Comment
Please, Sign In to add comment