Advertisement
MeehoweCK

Untitled

Dec 11th, 2020
562
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.65 KB | None | 0 0
  1. #include <iostream>
  2. #include <ctime>
  3. #include <cstdlib>
  4.  
  5. using namespace std;
  6.  
  7. void array_print(int* array)
  8. {
  9.     for(int i = 0; i < 6; ++i)
  10.         cout << array[i] << '\t';
  11.     cout << endl;
  12. }
  13.  
  14. bool is_repeating(int* array, int number, int n)
  15. {
  16.     for(int i = 0; i < n; ++i)
  17.         if(array[i] == number)
  18.             return true;
  19.     return false;
  20. }
  21.  
  22. void fill_array(int* array)
  23. {
  24.     srand(time(nullptr));
  25.     // rand() - returns a drawn number from interval <1; 32767>
  26.     for(int i = 0; i < 6; ++i)
  27.         array[i] = 1 + rand() % 50;
  28. }
  29.  
  30. int main()
  31. {
  32.     int arr[6];
  33.     fill_array(arr);
  34.     array_print(arr);
  35.     return 0;
  36. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement