Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- #include <fstream>
- #include <climits>
- using namespace std;
- ifstream fin("bac.txt");
- int main() {
- int x;
- fin >> x;
- int maxi = INT_MIN, mini = INT_MAX;
- bool ok = false;
- if (9 < x && x < 100) {
- maxi = mini = x;
- ok = true;
- }
- while (fin >> x) {
- if (9 < x && x < 100) {
- ok = true;
- if (mini > x) {
- mini = x;
- }
- if (maxi < x) {
- maxi = x;
- }
- }
- }
- if (!ok) {
- cout << "nu exista" << endl;
- } else {
- cout << mini - 1 << ' ' << maxi + 1 << endl;
- }
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement