Advertisement
spacerose

1.2.3

Mar 10th, 2020
183
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.38 KB | None | 0 0
  1. #include <iostream>
  2. using namespace std;
  3. class Student {
  4. public: long n, k=0;
  5.     void zn() {
  6.         cout << "n = " <<n <<endl;
  7.     }
  8.     void kolvo() {
  9.         while (n > 0) {
  10.             k++;
  11.             n = n / 10;
  12.         }
  13.         cout << "N = " << k;
  14.     }
  15. };
  16. int main()
  17. {
  18.     Student abc;
  19.     int x;
  20.     cin >> x;
  21.     abc.n = x;
  22.     abc.zn();
  23.     abc.kolvo();
  24. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement