Нужно вывести результаты разными способами: с использование указателя, с использованием ссылки, через имя функции


#include
using namespace std;
int maxs_count(int* a, int size)
{
int max = a[0], k = 1;
for (int i = 1; i < size; i++)
if (max < a[i])
{
max = a[i]; k = 1;
}
else
if (a[i] == max) k++;
return k;
}
void maxs_count(int* a, int size, int&k)
{
int max = a[0];
k = 1;
for (int i = 1; i < size; i++)
if (max < a[i])
{
max = a[i]; k = 1;
}
else
if (a[i] == max) k++;
}
void maxs_count(int* a, int size, int* k)
{
int max = a[0];
*k = 1;
for (int i = 1; i < size; i++)
if (max < a[i])
{
max = a[i]; (*k) = 1;
}
else
if (a[i] == max) (*k)++;
}
int main()
{
int a[] = { 1,5,9,0,4,9,3,1,0,-4,9,2 };
int k;
//
cout
#include
using namespace std;
int max_element(int* box, const size_t n) {
int max = box[0];
for (size_t i = 1; i < n; ++i) if (max < box[i]) max = box[i];
return max;
}
size_t max_count(int* box, const size_t n) {
auto max = max_element(box, n);
size_t count = 0;
for (size_t i = 0; i < n; ++i) if (max == box[i]) ++count;
return count;
}
void max_count(int* box, const size_t n, int& ref) {
auto max = max_element(box, n);
for (size_t i = 0; i < n; ++i) if (max == box[i]) ++ref;
}
void max_count(int* box, const size_t n, int* ptr) {
auto max = max_element(box, n);
for (size_t i = 0; i < n; ++i) if (max == box[i]) ++*ptr;
}
int main() {
constexpr size_t n = 10;
int box[n]{};
cout