Advertisement
Guest User

Untitled

a guest
Nov 18th, 2019
95
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.44 KB | None | 0 0
  1. #include<bits/stdc++.h>
  2.  
  3. using namespace std;
  4. ifstream we;
  5. ofstream wy;
  6. string a;
  7. int x, maksymalna y = 0, srednia;
  8.  
  9. int main()
  10. {
  11. we.open("liczby.txt");
  12. wy.open("wyniki 3.46 c.txt");
  13.  
  14. while ( getline(we, a))
  15. {
  16. int i = atoi(a.c_str());
  17. if ( i < 11 )
  18. {
  19. suma+=i;
  20. Y++;
  21. }
  22. }
  23. srednia = suma/y;
  24.  
  25. cout << srednia;
  26.  
  27. we.close();
  28. wy.close();
  29. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement