Advertisement
SergeyPGUTI

7.1.11

Nov 27th, 2015
81
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.52 KB | None | 0 0
  1. #include <iostream>
  2. #include <cmath>
  3. #include<cstdlib>
  4. #include<ctime>
  5.  
  6. using namespace std;
  7. void clampArr(int *arr, int size, int min, int max)
  8. {
  9.     for(int i=0; i<size; i++)
  10.      {
  11.          if (arr[i]<min) arr[i]=min;
  12.          if (arr[i]>max) arr[i]=max;
  13.      }
  14. }
  15.  
  16.  
  17. int main()
  18. {
  19.     int n;
  20.     cin>>n;
  21.     int *Mas=new int[n];
  22.     int *p[n];
  23.     for (int i=0;i<n;i++)
  24.     {
  25.         cin>>Mas[i];
  26.     }
  27.     clampArr(Mas,10,5,10);
  28.     for (int i=0;i<n;i++)
  29.     {
  30.         cout<<Mas[i]<<endl;
  31.     }
  32. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement