fork(1) download
  1. #include<stdio.h>
  2. #include<stdlib.h>
  3. #include<time.h>
  4. #include<ctype.h>
  5.  
  6. char *randomizenouns(char *nouns[][10]);
  7. char *randomizeadj(char *adjectives[][17]);
  8.  
  9. int main() // beginning of program.
  10. {
  11. int a=0, b=0;
  12. char answers[5][100]={'\0'};
  13. char *rnouns[2][10]={'\0'};
  14. char *radjectives[2][17]={'\0'};
  15. char *rcolors[11]={'\0'};
  16.  
  17. radjectives[0][0]="intriguing";
  18. radjectives[0][1]="seductive";
  19. radjectives[0][2]="long";
  20. radjectives[0][3]="short";
  21. radjectives[0][4]="big";
  22. radjectives[0][5]="happy";
  23. radjectives[0][6]="sad";
  24. radjectives[1][0]="joyful";
  25. radjectives[1][1]="vibrant";
  26. radjectives[1][2]="cool";
  27. radjectives[1][3]="wonderful";
  28. radjectives[1][4]="quiet";
  29. radjectives[1][5]="cramped";
  30. radjectives[1][6]="loud";
  31.  
  32. rnouns[0][0]="puppies";
  33. rnouns[0][1]="masks";
  34. rnouns[0][2]="keyboards";
  35. rnouns[0][3]="hats";
  36. rnouns[0][4]="clocks";
  37. rnouns[0][5]="shoes";
  38. rnouns[0][6]="bats";
  39. rnouns[0][7]="balls";
  40. rnouns[0][8]="computers";
  41. rnouns[0][9]="frisbees";
  42. rnouns[1][0]="desks";
  43. rnouns[1][1]="mice";
  44. rnouns[1][2]="grapes";
  45. rnouns[1][3]="apples";
  46. rnouns[1][4]="cameras";
  47. rnouns[1][5]="pens";
  48. rnouns[1][6]="pencils";
  49. rnouns[1][7]="hot wheels";
  50. rnouns[1][8]="blocks";
  51. rnouns[1][9]="people";
  52.  
  53. rcolors[0]="black";
  54. rcolors[1]="purple";
  55. rcolors[2]="blue";
  56. rcolors[3]="yellow";
  57. rcolors[4]="teal";
  58. rcolors[5]="magenta";
  59. rcolors[6]="seafoam green";
  60. rcolors[7]="indigo";
  61. rcolors[8]="gold";
  62. rcolors[9]="silver";
  63. rcolors[10]="orange";
  64.  
  65. srand(time(NULL));
  66.  
  67. printf("\n\tProgram Paragrahs\n");
  68. printf("\tFor this program you will answer several questions which will then be used to conjure a random story the length of a paragraph.Please Keep your answers clean.Enjoy\n");
  69.  
  70. printf("\nWhat is your name?");
  71. scanf("%s\n",answers[0]);
  72. printf("\nWhat is your favorite book?");
  73. scanf("%s",answers[1]);
  74. printf("\nWhat is your favorite color?");
  75. scanf("%s",answers[2]);
  76. printf("\nWhat city do you live in?");
  77. scanf("%s",answers[3]);
  78. printf("\nWhat car do you drive?");
  79. scanf("%s",answers[4]);
  80.  
  81. printf("%s gets lost in their %s %s.\n",answers[0],randomizeadj(radjectives),answers[1]);
  82. printf("%s loves to play with %s %s.\n",answers[0],rcolors[(rand() %11)],randomizenouns(rnouns));
  83. printf("%s lives in a(n) %s %s.\n",answers[0],randomizeadj(radjectives),answers[3]);
  84. printf("While living in %s %s drives a(n) %s %s.\n",answers[3],answers[0],rcolors[(rand() %11)],answers[4]);
  85. printf("%s is a(n) %s person who likes the color %s.\n",answers[0],randomizeadj(radjectives),answers[2]);
  86. } // end of program
  87.  
  88. char *randomizenouns(char *nouns[][10])
  89. {
  90. int x=(rand() %3);
  91. int y=(rand() %10);
  92.  
  93. return nouns[x][y];
  94. }
  95.  
  96. char *randomizeadj(char *adjectives[][17])
  97. {
  98. int x=(rand() %2);
  99. int y=(rand() %7);
  100.  
  101. return adjectives[x][y];
  102. }
Success #stdin #stdout 0s 2900KB
stdin
Standard input is empty
stdout
	Program Paragrahs
	For this program you will answer several questions which will then be used to     conjure a random story the length of a paragraph.Please Keep your answers clean.Enjoy

What is your name?
What is your favorite book?
What is your favorite color?
What city do you live in?
What car do you drive? gets lost in their wonderful .
 loves to play with purple balls.
 lives in a(n) long .
While living in   drives a(n) indigo .
 is a(n) seductive person who likes the color  .