Advertisement
Guest User

Untitled

a guest
Mar 29th, 2017
60
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.54 KB | None | 0 0
  1. #include <iostream>
  2. #include <stdlib.h>
  3. #include <time.h>
  4. #define N 9
  5.  
  6. using namespace std;
  7.  
  8. int LM (int a[N], int M);
  9.  
  10. int main()
  11. {
  12. int A[N];
  13.  
  14. srand(time(0));
  15. for(int i=0; i<N; i++) {A[i]=rand()%500; cout << A[i] << " ";}
  16. cout << endl;
  17.  
  18. LM(A[N]);
  19.  
  20.  
  21.  
  22. return 0;
  23. }
  24.  
  25.  
  26. int LM (int a[N], int M)
  27. {
  28. M = new int [n];
  29.  
  30. int i=0;
  31. for(i<N; i++)
  32. {
  33. if((a[i-1]<a[i])&&(a[i]>a[i+1]) M[i]=a[i];
  34. }
  35. //for(i<N; i++) cout << M[i] << " ";
  36. //cout << endl;
  37.  
  38. return M[n];
  39. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement