fork download
  1. #include <iostream>
  2. #include <vector>
  3. using namespace std;
  4.  
  5. struct Duzylotek{
  6. Duzylotek(int li, string te) : liczba(li), tekst(te) { }
  7. int liczba;
  8. string tekst;
  9. };
  10.  
  11. int main() {
  12. vector<Duzylotek> kupony;
  13. for(int i=0;i<5;i++){
  14. kupony.emplace_back(i+1,"Test");
  15. cout << kupony[i].liczba << ", " << kupony[i].tekst << endl;
  16. }
  17. return 0;
  18. }
Success #stdin #stdout 0s 3232KB
stdin
Standard input is empty
stdout
1, Test
2, Test
3, Test
4, Test
5, Test