Advertisement
Guest User

Untitled

a guest
May 20th, 2018
130
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.48 KB | None | 0 0
  1. #include <iostream>
  2. #include <cmath>
  3. #include <fstream>
  4.  
  5. const char input[] = "input.txt";
  6. const char output[] = "o.txt";
  7.  
  8.  
  9. using namespace std;
  10.  
  11. void funk(int n);
  12.  
  13. int main()
  14. {
  15. int n;
  16.  
  17. ifstream fd(input);
  18.  
  19. fd >> n;
  20.  
  21. fd.close();
  22.  
  23. funk(n);
  24.  
  25. return 0;
  26. }
  27.  
  28. ofstream fr(output);
  29.  
  30. void funk(int n)
  31. {
  32. int numb = 0;
  33.  
  34. if (n > 0) {
  35. if (n >= 10) {
  36. fr << n % 10 << endl;
  37.  
  38. numb = n / 10;
  39.  
  40. funk(numb);
  41. }
  42. else {
  43. fr << n << endl;
  44. }
  45. }
  46. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement