I'm having some issues with my program and don't know where to look really. The user is supposed to enter 5 lines to make a limerick poem. When I check the file its code like 006CF744 and not the poem as desired. What should i fix?
#include<iostream>
#include <fstream>
#include <string>
usingnamespace std;
int main()
{
ofstream outFile;
outFile.open("C:\\Users\\Bryan Bean\\Limerick.dat");
string limerickArray[5];
for (int i = 0; i < 5; i++)
{
cout << "Enter Limerick line: " << i << endl;
getline(cin, limerickArray[i]);
cin.clear();
}
for (int i = 0; i < 5; i++)
{
outFile << limerickArray[i] << endl;
}
outFile.close();
system("pause");
return 0;
}
whenever i try for (int i = 1; i <= 5; i++) i keep getting an error in which i have to break(i guess due to the arrays size). What I want it to say is Enter Limerick line 1...instead of starting at 0. What's up with that. I thought setting i=1; i<=5 would do it be it's not.