#include <iostream>
#include<ctime>
using namespace std;
int main()
{
int N;
cout << "zadajte prirodzene cislo N: ";
cin>> N;
getchar();
srand ((unsigned)time(NULL));
int pole [N];
cout << "vygenerovane cisla: ";
for(int i=0; i<N; i++)
{
pole [i] = rand()%20+1;
cout << pole[i] << " ";
}
int a = pole[0];
int a_pocet=0;
for(int i=1; i<N; i++)
{
if(pole[i] < a)
{
a = pole [i];
}
}
cout << endl << endl << "Najmensie cislo je: " << a;
cout << endl << "Nachadza sa na mieste: ";
for(int i=1; i<N; i++)
{
if(pole[i] == a)
{
a_pocet+=1;
cout << i+1 << ". ";
}
}
cout << endl << "Opakuje sa: " << a_pocet<<" krat";
int b = pole [0];
int b_pocet=0;
for(int i=1; i<N; i++)
{
if(pole[i]>b)
{
b = pole[i];
}
}
cout << endl << endl << "Najvacsie cislo je: " << b;
cout << endl << "Nachadza sa na mieste: ";
for(int i=1; i<N; i++)
{
if(pole[i] == b)
{
b_pocet+=1;
cout << i+1 << ". ";
}
}
cout << endl << "opakuje sa: " << b_pocet<<" krat";
getchar();
return 0;
}
no tak spokojnosť je program ide :)