This is the code I am using to print output from my textfile
#include <iostream>
#include <fstream>
#include <string>
using namespace std;
int main()
{
string line[30];
ifstream myfile("input1.txt");
int a = 0;
if(!myfile)
{
cout<<"Error opening output file"<<endl;
system("pause");
return -1;
}
while(!myfile.eof())
{
getline(myfile,line[a],' ');
cout<<line1[a]<<"\n";
}
}
The text output is supposed to be:(Also the output is exactly the same as the input)
ABCDEFGHIJKLMNOPQRSTUVWXYZ
9876543210
MFCJABDEHGIKLTPNORSQWUVYXZ
SPHINCTERSAYSWHAT
524137968
MATLSO
FTERFO
EYBLEIF
LYBWIOL
SYGTHO
FPNOEDESO
LLTDREOI
But instead I get this output:
ABCDEFGHIJKLMNOPQRSTUVWXYZ
9876543210
MFCJABDEHGIKLTPNORSQWUVYXZ
SPHINCTERSAYSWHAT
524137968
MATLSO
(double space between these two)
FTERFO
(double space after this one)
EYBLEIF LYBWIOL(EYBLEIF on top and LYBWIOL directly under it with no new line)
SYGTHO FPNOEDESO LLTDREOI(all of these from top to bottom directly underneath each other)