Advertisement
rengetsu

ProcedurProgramavimas_3.10

May 21st, 2018
28
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.68 KB | None | 0 0
  1. #include <iostream>
  2. #include <fstream>
  3. #include <iomanip>
  4.  
  5. using namespace std;
  6.  
  7. ifstream fin("seka.txt");
  8. ofstream fout("seka_rez.txt");
  9.  
  10. void skaiciuojam(int *c)
  11. {
  12.     int z;
  13.     z = *c;
  14.     double newel, sum=0, minim=1000000, maxim=-1000000, vid;
  15.     for(int i=0;z>i;i++)
  16.     {
  17.         fin >> newel;
  18.         sum += newel;
  19.         if(newel>maxim)
  20.         {
  21.             maxim=newel;
  22.         }
  23.         if(newel<minim)
  24.         {
  25.             minim=newel;
  26.         }
  27.     }
  28.     fout<<minim<<endl;
  29.     fout<<maxim<<endl;
  30.     fout<<fixed<<setprecision(2)<<sum/z<<endl;
  31. }
  32.  
  33. int main()
  34. {
  35.     int g;
  36.     int *c;
  37.     fin >> g;
  38.     c=&g;
  39.     skaiciuojam(c);
  40.     return 0;
  41. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement