Advertisement
Guest User

Untitled

a guest
Apr 26th, 2018
66
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.69 KB | None | 0 0
  1. #include <iostream>
  2. #include <conio.h>
  3. #include <ctime>
  4.  
  5. using namespace std;
  6.  
  7. void wypelnienietablicyzerami(int i, int tab[100])
  8. {
  9.     for(i=0; i<100; i++)
  10.     {
  11.         tab[i] = 0;
  12.     }
  13. }
  14.  
  15.  
  16. int main()
  17. {
  18.     srand(time(NULL));
  19.     int tab[100];
  20.     int tablica[100];
  21.     int losowana, i;
  22.  
  23.     wypelnienietablicyzerami(i, tab);
  24.  
  25.     for(int a=0; a<100; a++)
  26.     {
  27.         losowana = rand()%201+50;
  28.         for(int x=0; x<100; x++)
  29.         {
  30.             if(losowana != tab[x])
  31.             {
  32.                 tab[a] = losowana;
  33.             }
  34.         }
  35.     }
  36.  
  37.     for(int q=0; q<100; q++)
  38.     {
  39.         cout << tablica[q] << endl;
  40.     }
  41.  
  42.  
  43.     getch();
  44.     return 0;
  45. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement