Advertisement
Dani_info

nr care contin 7

Feb 13th, 2018
99
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.  
  6. int main()
  7. {  
  8.     ifstream in("datein.txt");
  9.     ofstream out("dateout.txt");
  10.     int n;
  11.     while (in >> n)
  12.     {  
  13.         int p = n;
  14.         int ok = 0;
  15.         while (p)
  16.         {
  17.             if (p % 10 == 7)
  18.                 ok = 1;
  19.             p /= 10;
  20.  
  21.         }
  22.         if (ok==1)
  23.             out << n << " ";
  24.     }
  25.     return 0;
  26.  
  27. }
Advertisement
RAW Paste Data Copied
Advertisement