I can open the files, and copy text from the input file to the output file and to the screen. but am struggling with the printing the numbers, right-adjustment and the instructions that are give i.e
Print the line number at the start of the line and right-adjusted in a field of three spaces. Follow the line number with a colon, then one space, then the text of the line.
my code so far is as below:
cout << "Enter input file name: ";
cin >> Input_file;
in_stream.open(Input_file);
if(in_stream.fail())
{
cout << "Input file failed to open.\n";
exit(1);
}
out_stream.open("output.txt"
;
if(out_stream.fail())
{
cout << "Output file failed to open.\n";
exit(1);
}
char next;
in_stream.get(next);
while (!in_stream.eof())
{
out_stream << next;
cout << next;
in_stream.get(next);
}