// Display Random String // C++ Example // www.TullyRankin.com #include #include #include #include #include #include using namespace std; string randomPhrase( const vector & p ); void clearScreen(); int main() { vector phrases(4); phrases[0] = "The more I C, the less I see."; phrases[1] = "Backups? We don’t need no stinking backups."; phrases[2] = "Avoid the Gates of Hell. Use Linux"; phrases[3] = "When you say \"I wrote a program that crashed Windows\", people just stare at you blankly and say \"Hey, I got those with the system, *for free*"; clearScreen(); while ( true ) { cout << randomPhrase( phrases ) << endl; usleep(5000000); clearScreen(); } return 0; } string randomPhrase( const vector & p ) { int size = p.size(); srand( time(NULL) ); return p[rand() % 4]; } void clearScreen() { for( int i = 0; i < 75; i++ ) cout << endl; }