fork download
  1. #include <iostream>
  2. #include <vector>
  3.  
  4. int main() {
  5.  
  6. std::vector<std::string> cmds = {"hi", "hello", "test"};
  7.  
  8. for (std::string command : cmds)
  9. {
  10. std::cout << command << std::endl;
  11. }
  12.  
  13. // your code goes here
  14. return 0;
  15. }
Compilation error #stdin compilation error #stdout 0s 0KB
stdin
Standard input is empty
compilation info
prog.cpp: In function ‘int main()’:
prog.cpp:6:56: error: in C++98 ‘cmds’ must be initialized by constructor, not by ‘{...}’
  std::vector<std::string> cmds = {"hi", "hello", "test"};
                                                        ^
prog.cpp:6:56: error: could not convert ‘{"hi", "hello", "test"}’ from ‘<brace-enclosed initializer list>’ to ‘std::vector<std::basic_string<char> >’
prog.cpp:8:29: error: range-based ‘for’ loops are not allowed in C++98 mode
  for (std::string command : cmds) 
                             ^
stdout
Standard output is empty