SHARE
TWEET

Untitled

a guest Oct 18th, 2019 90 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  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. }
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top