Advertisement
Guest User

Untitled

a guest
Mar 31st, 2020
77
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.50 KB | None | 0 0
  1. #include <stdlib.h>
  2. #include <stdio.h>
  3. #include <iostream>
  4. using namespace std;
  5.  
  6. class Long
  7. {
  8. private:
  9. long long int a;
  10.  
  11. public:
  12. Long (long long int n)
  13. {
  14. a = n;
  15. }
  16. void counter()
  17. {
  18. int count = 0;
  19. if (a == 0)
  20. {
  21. count = 1;
  22. cout << "N = " << count;
  23. }
  24. else
  25. {
  26. while (a!=0)
  27. {
  28. count++;
  29. a = a/10;
  30. }
  31. cout << "N = " << count;
  32. }
  33. }
  34.  
  35. void out()
  36. {
  37. cout << "n = " << a << endl;
  38. }
  39. };
  40.  
  41. int main()
  42. {
  43. long long int n;
  44. cin >> n;
  45. Long alf(n);
  46. alf.out();
  47. alf.counter();
  48. return(0);
  49. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement