123456789101112131415161718192021222324252627282930313233343536373839404142434445 |
- #include <iostream>
- using namespace std;
- int main(){
- const int n = 5;
- int array[n];
- int max, min;
- cout << "Input array's elements: " << endl;
- for (int i = 0; i < n; i++){
- cin >> array[i];
- }
- cout << "----------" << endl;
- max = min = array[0];
- for (int i = 0; i < n; i++){
- if (max < array[i]){
- max = array[i];
- }
- if (min > array[i]){
- min = array[i];
- }
- }
- for (int i = 0; i < n; i++){
- if (array[i] == max){
- array[i] = +1;
- }
- else if (array[i] == min){
- array[i] = -1;
- }
- }
- for (int i = 0; i < n; i++){
- cout << array[i] << endl;
- }
- return 0;
- }
|