fork download
  1. //#include "stdafx.h"
  2. #include "string"
  3. #include "vector"
  4. #include "iostream"
  5.  
  6.  
  7. using namespace std;
  8.  
  9. struct Board {
  10. vector<string> myVector{"IVal 1", "IVal 1"};
  11.  
  12. void push_back(string val)
  13. {
  14. myVector.push_back(val);
  15. }
  16.  
  17. void print()
  18. {
  19. for (auto it = myVector.begin(); it != myVector.end(); ++it)
  20. cout << " | " << *it;
  21. }
  22. };
  23.  
  24. int main()
  25. {
  26. Board b;
  27. b.push_back("Value 1");
  28. b.push_back("Value 2");
  29.  
  30. b.print();
  31.  
  32. return 0;
  33. }
Success #stdin #stdout 0s 4564KB
stdin
Standard input is empty
stdout
 | IVal 1 | IVal 1 | Value 1 | Value 2