Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- #include <fstream>
- using namespace std;
- void cmax(int a, int &b)
- {
- b=0;
- while(a)
- {
- if(a%10>b)
- b=a%10;
- a=a/10;
- }
- }
- int main()
- {
- int n, numere=0;
- ifstream f("bac.txt");
- while(f>>n)
- {
- int x;
- cmax(n,x);
- cout<<x<<" ";
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement