Guest User

Мургагоргорлагул

a guest
Aug 6th, 2015
248
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C 0.75 KB | None | 0 0
  1. #include <stdio.h>
  2. #include <stdlib.h>
  3. #include <time.h>
  4.  
  5. int last;
  6.  
  7. int rand1(int t)
  8. {
  9.     int z = rand() % t;
  10.     while(z == last)
  11.         z = rand() % t;
  12.     last = z;
  13.     return z;
  14. }
  15.  
  16. int main()
  17. {
  18.     srand(time(NULL));
  19.     int j, i, t;
  20.     for(j = 0; j < 20; ++j)
  21.     {
  22.         t = 5 + rand1(10);
  23.         printf("М");
  24.         if (rand1(2) == 1)
  25.             printf("а");
  26.         else
  27.             printf("у");
  28.         if (rand1(2) == 1)
  29.             printf("рг");
  30.         else
  31.             printf("гр");
  32.         printf("а");
  33.         for(i = 0; i < t; ++i)
  34.         {
  35.             switch(rand1(4))
  36.             {
  37.                 case 0:
  38.                     printf("р");
  39.                     break;
  40.                 case 1:
  41.                     printf("гу");
  42.                     break;
  43.                 case 2:
  44.                     printf("ла");
  45.                     break;
  46.                 case 3:
  47.                     printf("го");
  48.                     break;
  49.             }
  50.         }
  51.         printf(\n");
  52.     }
  53.     getchar();
  54.     return 0;
  55. }
Advertisement
Add Comment
Please, Sign In to add comment