fork download
  1. #include <iostream>
  2. #include <vector>
  3. using namespace std;
  4.  
  5.  
  6. struct Yoba {
  7. string razmer;
  8. string tip;
  9. };
  10.  
  11. ostream& operator << (ostream &o, const Yoba &y) {
  12. return o << "yoba " << y.tip << " vot takaya: " << y.razmer ;
  13. }
  14.  
  15. int main() {
  16. vector<Yoba> yobas;
  17. yobas.push_back({"malaya", "ehidnaya"});
  18. yobas.push_back({"malaya"});
  19. yobas.push_back({});
  20. //yobas.push_back({.tip = "sirnaya", .razmer = "bolshaya"});
  21.  
  22. for (int i = 0; i < yobas.size() ; ++i)
  23. cout << yobas[i] << endl;
  24.  
  25. return 0;
  26. }
Success #stdin #stdout 0s 3460KB
stdin
Standard input is empty
stdout
yoba ehidnaya vot takaya: malaya
yoba  vot takaya: malaya
yoba  vot takaya: