Advertisement
Dizzy3113

Untitled

Nov 3rd, 2019
79
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.33 KB | None | 0 0
  1. #include <iostream>
  2. #include <fstream>
  3. using namespace std;
  4. void cmax(int a, int &b)
  5. {
  6. b=0;
  7. while(a)
  8. {
  9. if(a%10>b)
  10. b=a%10;
  11. a=a/10;
  12. }
  13. }
  14. int main()
  15. {
  16. int n, numere=0;
  17. ifstream f("bac.txt");
  18. while(f>>n)
  19. {
  20. int x;
  21. cmax(n,x);
  22. cout<<x<<" ";
  23. }
  24.  
  25.  
  26. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement