Is it possible to write all output to a text file
Expected output (in the text file):
car
bike
plane
Actual output:
plane
Code (I tried a for loop) :
string vehicle[3]= { "car", "bike", "plane" };
for (int i = 0; i < 3; i++)
{
ofstream out_file("C:\\Users\\Gadr\\Desktop\\test.txt");
out_file << vehicle[i] << endl;
out_file.close();
}