Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <fstream>
- #include <vector>
- using namespace std;
- int main() {
- ofstream arquivo;
- arquivo.open("arquivo.txt");
- vector<string> v;
- v.push_back("linha1");
- v.push_back("linha2");
- v.push_back("linha3");
- if(arquivo.is_open()){
- for(auto n: v) { arquivo << n << endl; }
- }
- }
- #include <fstream>
- #include <vector>
- using namespace std;
- int main() {
- ofstream arquivo;
- arquivo.open("pasta/arquivo.txt");
- vector<string> v;
- v.push_back("linha1");
- v.push_back("linha2");
- v.push_back("linha3");
- if(arquivo.is_open()){
- for(auto n: v) { arquivo << n << endl; }
- }
- }
Add Comment
Please, Sign In to add comment