fork download
  1. #include <stdio.h>
  2. #include <stdlib.h>
  3. #include <time.h>
  4.  
  5. #define SIZE 5
  6. #define WORD_SIZE 20
  7.  
  8. int main(void)
  9. {
  10. const char *firstLines[SIZE] =
  11. {
  12. "There once was a programmer named Dave",
  13. "There once was a coder from town",
  14. "There once was a man with a plan",
  15. "There once was a student so bright",
  16. "There once was a hacker online"
  17. };
  18.  
  19. const char *secondLines[SIZE] =
  20. {
  21. "Who wrote all his code in a cave",
  22. "Who solved every bug with a frown",
  23. "Who worked through the night like a fan",
  24. "Who studied and coded all night",
  25. "Who typed every program just fine"
  26. };
  27.  
  28. const char *thirdLines[SIZE] =
  29. {
  30. "He debugged every day",
  31. "He compiled right away",
  32. "He followed his plan",
  33. "He practiced with might",
  34. "He learned every line"
  35. };
  36.  
  37. const char *fourthLines[SIZE] =
  38. {
  39. "And never would leave",
  40. "With no time to grieve",
  41. "And finished the span",
  42. "And solved every fight",
  43. "And checked every sign"
  44. };
  45.  
  46. const char *fifthLines[SIZE] =
  47. {
  48. "Until all his programs behaved",
  49. "And his bugs all went down",
  50. "And he became the best man",
  51. "And his answers were right",
  52. "And his code worked just fine"
  53. };
  54.  
  55. srand((unsigned int)time(NULL));
  56.  
  57. int choice = rand() % SIZE;
  58.  
  59. printf("%s\n", firstLines[choice]);
  60. printf("%s\n", secondLines[choice]);
  61. printf("%s\n", thirdLines[choice]);
  62. printf("%s\n", fourthLines[choice]);
  63. printf("%s\n", fifthLines[choice]);
  64.  
  65. return 0;
  66. }
Success #stdin #stdout 0s 5348KB
stdin
Standard input is empty
stdout
There once was a hacker online
Who typed every program just fine
He learned every line
And checked every sign
And his code worked just fine