Created
March 26, 2019 13:55
-
-
Save ThatNerdyPikachu/4a52aab34820943eeb0b3c1ba54b8d2d to your computer and use it in GitHub Desktop.
implementation of 10print in c++
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <iostream> | |
#include <random> | |
#include <unistd.h> | |
int RNGRange(int x, int y) { | |
std::random_device rnd; | |
std::mt19937 eng(rnd()); | |
std::uniform_int_distribution<> dstr(x, y); | |
return dstr(eng); | |
} | |
char GetNextChar() { | |
if (RNGRange(0, 1) == 0) { | |
return '/'; | |
} else { | |
return '\\'; | |
} | |
} | |
void TenPrint() { | |
for (int i = 0; i <= 30; i++) { | |
for (int i = 0; i <= 65; i++) { | |
std::cout << GetNextChar() << std::flush; | |
usleep(5000); | |
} | |
std::cout << "\n"; | |
} | |
} | |
int main() { | |
TenPrint(); | |
return 0; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment