So recently I have been developing a program that asks the user some questions and asks for their reply, it then stores it to an array, and writes it out to an output file, although I don't get the information the user inputs but this code thing: 0x4080c0
. Can someone please help me, here is my code as well:
#include <iostream>
#include <fstream>
#include <string>
using namespace std;
string q1 = "Distance Flown:";
string q2 = "Total Fuel Used:";
string q3 = "Total Flight Time:";
string q4 = "Number Of Passengers:";
string q5 = "Total Profit:";
string q6 = "Any futher comments goes here:";
string logAwensers[6];
int main()
{
cout << "Please enter your pilot log here."<< endl;
cout << q1 << endl;
getline(cin, logAwensers[0]);
cout << q2 << endl;
getline(cin, logAwensers[1]);
cout << q3 << endl;
getline(cin, logAwensers[2]);
cout << q4 << endl;
getline(cin, logAwensers[3]);
cout << q5 << endl;
getline(cin, logAwensers[4]);
cout << q6 << endl;
getline(cin, logAwensers[5]);
cout << logAwensers << endl;
ofstream writer("PilotLog.txt", ios::app);
if(! writer)
{
cout << "Error writing file" << endl;
}
return -1;
}
writer << logAwensers << endl;
writer.close();
return 0;
}
Thanks.