Advertisement
Guest User

Untitled

a guest
Feb 19th, 2020
94
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.71 KB | None | 0 0
  1. #include <ctime>
  2. #include <iostream>
  3. using namespace std;
  4.  
  5. const int N = 100;
  6. void inp_array(int* x, int n);
  7. void out_array(int* x, int n);
  8. void inp_array_rand(int* x, int n);
  9.  
  10. void main() {
  11. int n, a[N];
  12. cin >> n;
  13. if (n<1 || n>N) {
  14. cout << "ERROR Size\n";
  15. return;
  16. }
  17.  
  18. out_array(a, n);
  19. inp_array_rand(a, n);
  20.  
  21. }
  22.  
  23. void inp_array(int* x, int n) {
  24. cout << "Vvedite" << n << "chisel\n";
  25. for (int i = 0; i < n; i++)
  26. cin >> x[i];
  27. }
  28.  
  29. void out_array(int* x, int n) {
  30. cout << "\n massiv chisel\n";
  31. for (int i = 0; i < n; i++)
  32. cout << x[i] << " ";
  33. cout << endl;
  34. }
  35.  
  36. void inp_array_rand(int* x, int n) {
  37. srand(time(0));
  38. for (int i = 0; i < n; i++) {
  39. x[i] = rand() % 56;
  40. }
  41. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement