Advertisement
NyanCoder

Untitled

May 12th, 2016
284
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.55 KB | None | 0 0
  1. #include <fstream>
  2. #include <limits> // только для второго задания
  3.  
  4. // 1
  5.  
  6.     // ...
  7.     float buff = 0;
  8.     std::ifstream fin("f");
  9.     while (!fin.eof()) fin >> buff;
  10.     fin.close();
  11.     std::ofstream fout("f1");
  12.     fout << buff;
  13.     fout.close();
  14.     // ...
  15.  
  16. // 2
  17.  
  18.     // ...
  19.     float buff = 0, maxfloat = std::numeric_limits<float>::min();
  20.     std::ifstream fin("f");
  21.     while (!fin.eof())
  22.     {
  23.         fin >> buff;
  24.         maxfloat = (maxfloat < buff ? buff : maxfloat);
  25.     }
  26.     fin.close();
  27.     std::ofstream fout("f1");
  28.     fout << maxfloat;
  29.     fout.close();
  30.     // ...
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement