Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- using namespace std;
- const int N = 10;
- typedef int A[N];
- void func(int arr[], int n);
- int main() {
- int n;
- const int r = 10;
- int A[r];
- cout << "Elements: |";
- for (int r = 0; r < N; r++)
- {
- A[r] = rand() % 10;
- cout << A[r] << "|";
- }
- n = N;
- func(A, n);
- return 0;
- }
- void func(int arr[] , int n)
- {
- n = N;
- int min, max;
- max = arr[0];
- min = arr[0];
- for (int s = 0; s < N - 1; s++)
- {
- if (max < arr[s+1]) max = arr[s+1];
- if (min > arr[s+1]) min = arr[s+1];
- }
- cout << "Min: " << min << endl;
- cout << "Max: " << max << endl;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement