#include <iostream> using namespace std; int main() { std::ofstream ofs(filename.c_str()); for(std::vector<std::string>::const_iterator it=Vec.begin(); it != Vec.end(); ++it) ofs<<*it<<' '; ofs<<'\n'; ofs<<'\n'; ofs.close(); ifs.close(); return 0; }
Standard input is empty
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(); ^
Standard output is empty