Advertisement
Guest User

Mongolian VD

a guest
Feb 18th, 2018
75
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 2.56 KB | None | 0 0
  1. // Full version:
  2. // (Note that generally speaking utility functions go at the top,
  3. //  with main functions calling the functions above.
  4. //  Therefore start from main() and follow the program execution.)
  5. #include <iostream>
  6. #include <exception>
  7.  
  8. struct mongolian_vd : std::exception
  9. {
  10.     const char *what() const throw()
  11.     {
  12.         return "Mongolian VD!";
  13.     }
  14. };
  15.  
  16. namespace sti
  17. {
  18.     void fun();
  19. }
  20.  
  21. void catch_mongolian_vd()
  22. {
  23.     std::cout << "\tUnmentionable acts have been commited!\n\n";
  24.     // throw to catch? huh?
  25.     throw mongolian_vd();
  26. }
  27.  
  28. void sti::fun()
  29. {
  30.     std::cout << "Executing sti::fun() ...\n";
  31.     catch_mongolian_vd();
  32. }
  33.  
  34. void chinese_herbalism()
  35. {
  36.     std::cout << "Trying chinese_herbalism()\n\n";
  37.     std::cout << "\tThe Chinese herbalist says:\n";
  38.     std::cout << "\t\tWhat? Western doctor tell you need to amputate?!\n";
  39.     std::cout << "\t\tHa ha ha ha ha!\n\n";
  40.    
  41.     std::cout << "\t\tNo! Operation is very expensive!\n";
  42.     std::cout << "\t\tWestern doctor just want money!\n\n";
  43.     std::cout << "\t\tNo, no, no, no, we do not need amputate. You just relax.\n\n";
  44.     std::cout << "\t\t... just wait two week, penis fall off on its own!\n\n";
  45. }
  46.  
  47. void aromatherapy()
  48. {
  49.     enum class scent_t
  50.     {
  51.         yes = 0,
  52.         no = 1,
  53.         maybe = 2,
  54.         verytrue = 3,
  55.         untrue = 4,
  56.         undefined = 5,
  57.         patchouli = 9001,
  58.     };
  59.    
  60.     std::cout << "Trying aromatherapy()\n\n";
  61.     scent_t olfactory_receptor = scent_t::patchouli;
  62.     std::cout << "\tMmmh, patchouli.\n\n";
  63. }
  64.  
  65. void poke(int &address, int value)
  66. {
  67.     address = value;
  68. }
  69.  
  70. void accupuncture()
  71. {
  72.     std::cout << "Trying accupuncture()\n\n";
  73.     // this integer represents the number of needles in your back
  74.     int back = 0;
  75.     poke(back, 15);
  76.     std::cout << "\tOuch!\n\n";
  77. }
  78.  
  79. void seek_cure_from_alternative_medicine()
  80. {
  81.     accupuncture();
  82.     aromatherapy();
  83.     chinese_herbalism();
  84. }
  85.  
  86. bool western_medicine()
  87. {
  88.     std::cout << "Seeking cure from western_medicine():\n\n";
  89.     std::cout << "\tThe Doctor says:\n";
  90.     std::cout << "\t\tI'm very sorry to have to tell you this ...\n";
  91.     std::cout << "\t\tWe have no choice ...\n";
  92.     std::cout << "\t\t... but to fully amputate your penis, immediately.\n\n";
  93.     const bool accept_prognosis = false;
  94.     return accept_prognosis;
  95. }
  96.  
  97. int main(int argc, char **argv)
  98. {
  99.     try {
  100.         sti::fun();
  101.     } catch (mongolian_vd &exception) {
  102.         std::cout << "Caught: " << exception.what() << "\n\n";
  103.         if (!western_medicine()) {
  104.             std::cout << "\twestern_medicine() returned false and was unable to provide a cure!\n\n";
  105.             seek_cure_from_alternative_medicine();
  106.         }
  107.     }
  108.    
  109.     return 0;
  110. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement