Advertisement
Guest User

Untitled

a guest
May 27th, 2019
89
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.70 KB | None | 0 0
  1. #include "pch.h"
  2. #include <iostream>
  3. #include <vector>
  4.  
  5. using namespace std;
  6.  
  7. struct my_data {
  8.     int number_flight;
  9.     string fio;
  10.     int number_thing;
  11.     vector<int> my_vector;
  12. };
  13. ostream& operator<<(ostream& stream, vector<my_data> my_vector) {
  14.     for (auto& elem : my_vector) {
  15.         stream << elem.number_flight << endl;
  16.         for (auto& item : elem.fio) {
  17.             stream << item;
  18.         }
  19.         stream << endl << elem.number_thing << endl;
  20.         for (auto& item : elem.my_vector) {
  21.             stream << item << " ";
  22.         }
  23.         stream << endl;
  24.     }
  25.     return stream;
  26. }
  27.  
  28. int main()
  29. {
  30.     vector<my_data> vector_sample = {{ 24,"Ivanov Ivan Ivanovich",4,{1,2,3,5} }, { 24,"Ivanov Ivan Ivanovich",4,{1,2,3,5} } };
  31.  
  32.     cout << vector_sample;
  33.  
  34. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement