Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- template <typename UporediviTip>
- void Analiza(const UporediviTip A[], int N, int &Bmin, int &Bmax)
- {
- Bmin = 0;
- Bmax = 0;
- UporediviTip mini(A[0]), maxi(A[0]);
- for(int i(1); i < N; i++)
- {
- if(A[i] < mini)
- mini = A[i];
- if(A[i] > maxi)
- maxi = A[i];
- }
- for(int i(0); i < N; i++)
- {
- if(A[i] == mini)
- Bmin++;
- if(A[i] == maxi)
- Bmax++;
- }
- }
- int main()
- {
- int N1, N2;
- double Niz[10] = {2.5, 6, 1.25, 6, 6, -2.19, -1, 0, 3, 1};
- Analiza(Niz, 10, N1, N2);
- std::cout << "Bmin: " << N1 << std::endl << "Bmax: " << N2;
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement