Advertisement
Paul1898989

Untitled

Jun 16th, 2024 (edited)
656
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.50 KB | None | 0 0
  1. struct ChristmasTree{
  2.     int height;   // высота дерева
  3.     vector<int> num_stars; // количество звезд на каждом уровне высоты.
  4.     // Если h = 2, то num_stars = {1, 2}
  5.     // Если h = 0, то num_stars = {}
  6.  
  7.     ChristmasTree(int h = 0){
  8.         // your code here  
  9.     }
  10. }
  11.  
  12.  
  13. ChristmasTree t = {3};
  14. cout << t;
  15.  
  16. stringstream ss("4");
  17. ChristmasTree t;
  18. ss >> t;
  19. cout << t.height << " " << t.num_stars.size() << endl; // out: 4 4
  20. cout << t;
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement