#include
using namespace std;
int main() {
int n=12, imax=0, imin=0;
int a[n];
srand(time(NULL));
cout<<"array:"<<endl;<br> for (int i=0; i {
a[i]=rand() % 50;
cout<<a[i]<<" ";<br> }
cout<<endl;<br> for (int i=1; i if (a[i] > a[imax]) imax = i;
if (a[i] < a[imin]) imin = i;
}
for (int i=0; i if (i == imax || i == imin) cout << " ! " << a[i] << " ! ";<br> else cout << a[i] << " ";<br> }
cout<<endl;<br> return 0;
}
Пример:
array:
31 0 13 29 13 34 33 42 40 26 48 24
31 ! 0 ! 13 29 13 34 33 42 40 26 ! 48 ! 24