Advertisement
Shaybaaa

Untitled

Feb 18th, 2020
543
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.56 KB | None | 0 0
  1. //Zadanie 5
  2. #include <iostream>
  3. #include <cstdlib>
  4. #include <fstream>
  5. using namespace std;
  6. int main(int argc, char** argv)
  7. {
  8.     fstream file;
  9.     file.open("liczby.txt");
  10.     int x;
  11.     for (int i=0; i<1000; i++)
  12.     {
  13.         file>>x;
  14.         int p=0;
  15.         cout<<x<<"-> ";
  16.         for (int d=0; d<=x; d++)
  17.         {
  18.             while (x!=0)
  19.             {
  20.                 p=p+x%10;
  21.                 x=x/10;
  22.             }
  23.             cout<<p;
  24.         }
  25.         cout<<endl;
  26.     }
  27.     cout<<"--------------------------------"<<endl;
  28.     cout<<"Kurwa przypadkowo mi wyszlo XD";
  29.     return 0;
  30. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement