Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- #include <stdlib.h>
- #include <time.h>
- #define N 9
- using namespace std;
- int LM (int a[N], int M);
- int main()
- {
- int A[N];
- srand(time(0));
- for(int i=0; i<N; i++) {A[i]=rand()%500; cout << A[i] << " ";}
- cout << endl;
- LM(A[N]);
- return 0;
- }
- int LM (int a[N], int M)
- {
- M = new int [n];
- int i=0;
- for(i<N; i++)
- {
- if((a[i-1]<a[i])&&(a[i]>a[i+1]) M[i]=a[i];
- }
- //for(i<N; i++) cout << M[i] << " ";
- //cout << endl;
- return M[n];
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement