Advertisement
alexdmin

8.1(n)

Apr 25th, 2021
87
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.76 KB | None | 0 0
  1. #include <iostream>
  2. #include <string>
  3. #include <ostream>
  4.  
  5. using namespace std;
  6.  
  7. class words {
  8.     char word1;
  9. public:
  10.    
  11.     words(); // конструктор инициализации слова заданным словом-инициализатором
  12.     words(int a, char b); // инициализации слова заданным количеством повторов заданного символа
  13.    
  14.     void print()
  15.     {
  16.         cout << word1;
  17.     }
  18. };
  19.  
  20. // реализация конструкторов
  21. words::words(void)
  22. {
  23.     word1 = 'sjGE';
  24. }
  25. words::words(int a, char b)
  26. {
  27.     word1 = 'AAAA';
  28.     //for (int i = 0; i < a; i++)
  29.     //{
  30.     //  word1[i] = b;
  31.     //}
  32. }
  33.  
  34.  
  35. int main()
  36. {
  37.     char sl;
  38.     int a = 4;
  39.     words s1(NULL);
  40.     s1.print();
  41.     return 0;
  42. }  
  43.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement