Advertisement
Guest User

Untitled

a guest
Jun 23rd, 2017
56
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.38 KB | None | 0 0
  1. #include <iostream>
  2. #include <string>
  3. #include <fstream>
  4. using namespace std;
  5. void saveArray(string* array, int length);
  6.  
  7. void saveArray(string* array, int length)
  8. {
  9. ofstream File("File.txt");
  10. for(int i=0;i<length;i++)
  11. {
  12. File<<array[i]<<endl;
  13. }
  14. }
  15.  
  16. int main ()
  17.  
  18. {
  19. string inventory[] = {"Sword", "Armor", "Shield"};
  20. saveArray(inventory, 4);
  21. cout << "info saved";
  22. return 0;
  23. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement