I'm sorry this is a little long.. but please help if you can.
Here is my code.
When I am opening a txt file and transferring its content into a different selected txt file, it always have one "word" too many. Any ideas?
for(int i = 1; i < word2.size(); i++)
Indexes starts from 0: for(int i = 0; i < word2.size(); i++)
Even better:
1 2
for(auto x: word2)
out_file << x << endl;
Some notes:
1) Latest standart version can take strings instead of c-strings as arguments almost everywhere.
2) You can tell which file to open in constructor
Combining both:
1 2 3 4
cout << "Please enter the file name: ";
string file;
getline(cin, file);
ifstream in_file(file);
3)return main() ;
Do not do that. Ever. Do not call main().