Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- /*
- Troll Header file by Kilobyte. Including this WILL make your program a single bug.
- I am pretty sure most applications won't even launch with it lol :P
- (Hint: include on April first)
- CHANGELOG:
- 1.0.1
- Added Fake Segfault with a 0.25% chance on every output
- */
- #include <stdio.h>
- #include <signal.h>
- #ifdef __cplusplus
- #include <iostream>
- #include <cstdlib>
- #endif
- bool troll_initialized;
- void init_troll(void) {
- if (troll_initialized)
- return;
- srand(0);
- troll_initialized = true;
- }
- void printtroll(char* x) {
- init_troll();
- if (rand() % 100 == 0)
- printf("The author of this application sucks\n");
- printf(x);
- if (rand() % 400 == 0)
- raise(SIGSEGV); // Yes, i am really evil...
- }
- int maybe(void) {
- init_troll();
- int randomval = rand() % 100;
- return randomval;
- }
- #ifdef __cplusplus
- char* trollout(int chance) {
- init_troll();
- if (rand() % 400 == 0)
- raise(SIGSEGV);
- if (rand() % 100 < chance)
- return "The author of this application sucks\n";
- return "";
- }
- #endif
- #undef true
- #undef false
- #define printf(x) printtroll(x)
- #define true maybe() // make booleans undecided
- #define false !maybe()
- #ifdef __cplusplus
- #define cout cout << trollout(1)
- #define cerrt cerr << trollout(5)
- #endif
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement