Guest User

Untitled

a guest
Dec 18th, 2018
76
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.55 KB | None | 0 0
  1. #include "pch.h"
  2. #include <iostream>
  3. #include <time.h>
  4. #define SIZE 12
  5. #define MIN_VALUE 0
  6. #define MAX_VALUE 100
  7. #define Random(min, max) (min + rand() % ((max + 1) - min))
  8. using namespace std;
  9.  
  10. int main() {
  11. srand(time(NULL));
  12. int a[SIZE], b[3];
  13. int i, max = 0;
  14. for (i = 0; i < SIZE; i++)
  15. a[i] = Random(MIN_VALUE, MAX_VALUE);
  16. cout << "Source array: " << endl;
  17. for (i = 0; i < SIZE; i++)
  18. cout << " " << a[i];
  19. for (i = 0; i < SIZE; i++) {
  20. if (a[i] > max) max = a[i];
  21. }
  22.  
  23. cout << max;
  24. return(0);
  25. }
Add Comment
Please, Sign In to add comment