Zadanie 11 Lista 2 - Pastebin
Facebook
From Dawid Chawrona, 3 Days ago, written in C.
Embed
Download Paste or View Raw
Hits: 57
  1. // ZADANIE 11
  2. #include <stdio.h>
  3. #include <stdlib.h>
  4. #include <time.h>
  5.  
  6. int main() {
  7.     srand(time(NULL));
  8.  
  9.     char* article[3] = {"ta", "ten", "to"};
  10.     char* noun[6] = {"chlopak", "dziewczyna", "pies", "miasto", "samochod", "kot"};
  11.     char* verb[4] = {"skoczyl", "uciekl", "szedl", "przeskoczyl"};
  12.     char* preposition[5] = {"do", "z", "na", "nad", "pod"};
  13.  
  14.     for (int i = 0; i < 20; i++) {
  15.         char* zdanie[6];
  16.        
  17.         zdanie[0] = article[rand() % 3];
  18.         zdanie[1] = noun[rand() % 6];
  19.         zdanie[2] = verb[rand() % 4];
  20.         zdanie[3] = preposition[rand() % 5];
  21.         zdanie[4] = article[rand() % 3];
  22.         zdanie[5] = noun[rand() % 6];
  23.        
  24.         for (int i = 0; i < 6; i++) printf("%s ", zdanie[i]);
  25.         printf("\n");
  26.     }
  27.    
  28.     return 0;
  29. }