Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- //#1d
- #include <iostream>
- #include <fstream>
- using namespace std;
- int main()
- {
- ifstream fin("Input.txt");
- if(fin.is_open() == 0){
- cout << "Bad file!";
- return 0;
- }
- //ofstream fout("output.txt");
- double mx = -9223372036854775808, mn = 9223372036854775807, temp;
- while(fin >> temp){
- if(temp >= 0){ //если число положительное
- if(temp < mn){ //если новое число меньще минимального из предыдущих
- mn = temp;
- }
- }else{ //число отрицательное
- if(temp > mx){
- mx = temp;
- }
- }
- }
- cout << mx << " " << mn;
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment