Advertisement
Guest User

Untitled

a guest
Jun 16th, 2019
81
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.55 KB | None | 0 0
  1. #include <iostream>
  2. #include <string>
  3. #include <cstdio>
  4.  
  5. using namespace std;
  6.  
  7. class TClass
  8. {
  9. public:
  10.     int i;
  11.     double d;
  12.     char c;
  13.  
  14.     TClass() : i(0), d(0.0), c('0') {}
  15.  
  16.     TClass(int init_i, double init_d, char init_c) : i(init_i), d(init_d), c(init_c) {}
  17.  
  18.     void print_method()
  19.     {
  20.         cout << i << " " << d << " " << c;
  21.     }
  22. };
  23.  
  24. int main()
  25. {
  26.     //freopen("output.txt", "w", stdout);
  27.  
  28.     TClass t; // без параметров
  29.     t.print_method();
  30.  
  31.     TClass t1(1, 2.0, '3'); // С ними
  32.     t1.print_method();
  33.  
  34.     //getc(stdin);
  35.     return 0;
  36. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement