Guest User

Untitled

a guest
May 20th, 2018
106
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.63 KB | None | 0 0
  1. #include <fstream>
  2. #include <vector>
  3.  
  4. using namespace std;
  5. int main() {
  6. ofstream arquivo;
  7. arquivo.open("arquivo.txt");
  8. vector<string> v;
  9. v.push_back("linha1");
  10. v.push_back("linha2");
  11. v.push_back("linha3");
  12. if(arquivo.is_open()){
  13. for(auto n: v) { arquivo << n << endl; }
  14. }
  15. }
  16.  
  17. #include <fstream>
  18. #include <vector>
  19.  
  20. using namespace std;
  21. int main() {
  22. ofstream arquivo;
  23. arquivo.open("pasta/arquivo.txt");
  24. vector<string> v;
  25. v.push_back("linha1");
  26. v.push_back("linha2");
  27. v.push_back("linha3");
  28. if(arquivo.is_open()){
  29. for(auto n: v) { arquivo << n << endl; }
  30. }
  31. }
Add Comment
Please, Sign In to add comment