Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- using namespace std;
- int main()
- {
- setlocale(LC_ALL, "rus");
- int s, min = 1001, max = -1, temp, count = 0, tempbefore, smax = 0;
- cin >> temp;
- while (temp != 0) {
- tempbefore = temp;
- if (temp < min) {
- min = temp;
- }
- if (temp > max) {
- max = temp;
- }
- count++;
- cin >> temp;
- if (temp < tempbefore) {
- s = max - min;
- min = 1001;
- max = -1;
- if (smax < s) {
- smax = s;
- }
- }
- }
- cout << "Получено " << count << " чисел" << endl << "Наибольшая высота подъема: " << smax;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement