#include <iostream>
int main() {
int *array = new int[10];
int max, i = 0, count = 0;
std::cout << "Input 10 integers" << std::endl;
do{
std::cin >> array[i];
i += 1;
} while (i < 10);
max = *array;
i = 0;
do{
if (array[i] > max) {
max = array[i];
}
i += 1;
} while (i < 10);
i = 0;
do{
if (array[i] == max) {
count += 1;
}
i += 1;
} while (i < 10);
std::cout << "Max value is " << max << ". You can see it " << count << " times in the array" << std::endl;
}
Comments
Leave a comment