fork download
  1. #include <iostream>
  2. using namespace std;
  3.  
  4. int main() {
  5. std::ofstream ofs(filename.c_str());
  6. for(std::vector<std::string>::const_iterator it=Vec.begin(); it != Vec.end(); ++it)
  7. ofs<<*it<<' ';
  8. ofs<<'\n';
  9. ofs<<'\n';
  10. ofs.close();
  11. ifs.close();
  12. return 0;
  13. }
Compilation error #stdin compilation error #stdout 0s 0KB
stdin
Standard input is empty
compilation info
prog.cpp: In function 'int main()':
prog.cpp:5:20: error: variable 'std::ofstream ofs' has initializer but incomplete type
  std::ofstream ofs(filename.c_str());
                    ^
prog.cpp:5:20: error: 'filename' was not declared in this scope
prog.cpp:6:6: error: 'vector' is not a member of 'std'
  for(std::vector<std::string>::const_iterator it=Vec.begin(); it != Vec.end(); ++it)
      ^
prog.cpp:6:29: error: expected primary-expression before '>' token
  for(std::vector<std::string>::const_iterator it=Vec.begin(); it != Vec.end(); ++it)
                             ^
prog.cpp:6:30: error: '::const_iterator' has not been declared
  for(std::vector<std::string>::const_iterator it=Vec.begin(); it != Vec.end(); ++it)
                              ^
prog.cpp:6:63: error: 'it' was not declared in this scope
  for(std::vector<std::string>::const_iterator it=Vec.begin(); it != Vec.end(); ++it)
                                                               ^
prog.cpp:6:69: error: 'Vec' was not declared in this scope
  for(std::vector<std::string>::const_iterator it=Vec.begin(); it != Vec.end(); ++it)
                                                                     ^
prog.cpp:11:2: error: 'ifs' was not declared in this scope
  ifs.close();
  ^
stdout
Standard output is empty