Advertisement
miknik97

:<

Oct 15th, 2018
370
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.84 KB | None | 0 0
  1. #include <iostream>
  2. #include <cstdlib>
  3. #include <time.h>
  4. #include <stdio.h>
  5.  
  6. #include <iostream>
  7.  
  8. using namespace std;
  9. void zad1()
  10. {
  11.     int liczba, tab[50], a=0, i=0;
  12.     srand(time(NULL));
  13.  
  14.     do
  15.     {
  16.         tab[i] = rand()%49+1;
  17.         for(int j=0; j<i; j++)
  18.         {
  19.            if(tab[i]!=tab[j])
  20.            {
  21.                tab[i]=rand()%49+1;
  22.                a++;
  23.            }
  24.            else break;
  25.         }
  26.  
  27.  
  28.         i++;
  29.     } while(a<6);
  30. }
  31.  
  32.  
  33.  
  34. int main()
  35. {
  36.     zad1();
  37.     return 0;
  38. }
  39.  
  40.  
  41. /*
  42.     1. Wygenerować 6 liczb z zakresu 1 do 49 bez powtórzeń
  43.     2.Problem wydawania reszty:
  44.     a) wydać dowolną reszę przy założeniu nieograniczonej ilośći nomniałów
  45.     b) przy założeniu ograniczonej ilości nominałów
  46.     3.Znaleźć minimum funkcji f(x, y) = x^3*ln(1-sin^2*sqrt(x);y
  47. */
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement