Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- #include <cmath>
- #include<cstdlib>
- #include<ctime>
- using namespace std;
- void clampArr(int *arr, int size, int min, int max)
- {
- for(int i=0; i<size; i++)
- {
- if (arr[i]<min) arr[i]=min;
- if (arr[i]>max) arr[i]=max;
- }
- }
- int main()
- {
- int n;
- cin>>n;
- int *Mas=new int[n];
- int *p[n];
- for (int i=0;i<n;i++)
- {
- cin>>Mas[i];
- }
- clampArr(Mas,10,5,10);
- for (int i=0;i<n;i++)
- {
- cout<<Mas[i]<<endl;
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement