Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- using namespace std;
- int main() {
- int liczba;
- int max;
- int min;
- int poz_min = 0;
- int poz_max = 0;
- int obecna_pozycja = 0;
- while (cin >> liczba)
- {
- if (liczba >= max || obecna_pozycja == 0) {
- max = liczba;
- poz_max = obecna_pozycja;
- }
- if (liczba < min || obecna_pozycja == 0) {
- min = liczba;
- poz_min = obecna_pozycja;
- }
- obecna_pozycja++;
- }
- cout << min << endl;
- cout << poz_min << endl;
- cout << max << endl;
- cout << poz_max << endl;
- system("pause");
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement