Advertisement
Guest User

Untitled

a guest
Oct 18th, 2019
102
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.55 KB | None | 0 0
  1. #include <iostream>
  2. #include <fstream>
  3.  
  4. using namespace std;
  5. int cifre(int n,int c)
  6. {
  7. int k=0;
  8. while(n)
  9. {
  10. if(n%10==c)
  11. k++;
  12. n/=10;
  13. }
  14. return k;
  15. }
  16.  
  17. int main()
  18. {
  19. int x,cop,ok;
  20. ifstream f("date.in");
  21. ofstream g("date.out");
  22. while(f>>x)
  23. {
  24. cop=x;
  25. ok=1;
  26. while(cop>9)
  27. {
  28. if(cifre(cop/10,cop%10)!=0)
  29. ok=0;
  30. cop/=10;
  31. }
  32.  
  33. if(ok)
  34. g<<x<<" ";
  35. }
  36. f.close();
  37. return 0;
  38. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement