fork download
  1. #include <stdio.h>
  2. #include <stdlib.h>
  3. #include <time.h>
  4. #include <ctype.h>
  5.  
  6. int main(void) {
  7. const char *article[] = {"the", "a", "one", "some", "any"};
  8. const char *noun[] = {"boy", "girl", "dog", "town", "car"};
  9. const char *verb[] = {"drove", "jumped", "ran", "walked", "skipped"};
  10. const char *preposition[] = {"to", "from", "over", "under", "on"};
  11. char sentence[100];
  12.  
  13. srand(time(NULL));
  14.  
  15. for (int i = 0; i < 20; i++) {
  16. sprintf(sentence, "%s %s %s %s %s %s.",
  17. article[rand() % 5], noun[rand() % 5],
  18. verb[rand() % 5], preposition[rand() % 5],
  19. article[rand() % 5], noun[rand() % 5]);
  20.  
  21. sentence[0] = toupper(sentence[0]); // تكبير الحرف الأول
  22. printf("%s\n", sentence);
  23. }
  24. return 0;
  25. }
Success #stdin #stdout 0.01s 5300KB
stdin
Standard input is empty
stdout
A boy skipped on any car.
One car walked under the girl.
A car drove to any dog.
Any dog drove to any girl.
The girl skipped on a town.
A dog ran from one dog.
Some girl walked over the boy.
Any boy walked to some dog.
Some dog jumped from a car.
Any girl jumped from one boy.
The town skipped from a girl.
Any girl drove under some girl.
The town drove on the town.
The boy walked from any boy.
Some town skipped to one girl.
One girl skipped on a town.
The car drove over one dog.
A town drove from one car.
A boy skipped from the boy.
Any boy jumped from a car.