Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- #include <stdlib.h>
- #include <ctime>
- int main() {
- // Create a number that's 0 or 1
- srand (time(NULL));
- int coin = rand() % 2;
- // If number is 0: Heads
- // If it is not 0: Tails
- if (coin == 0) {
- std::cout << "Heads\n";
- }
- else {
- std::cout << "Tails\n";
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement