Hi, I'm in a beginning class in C++ and we need to make an assignment that inputs a file, prints it to the screen, and then prints it to the screen again with an underscore every 5 blanks. I got the last part to work, but I can't get it to print to the screen twice once without the underscores and once with the underscores.
It is also a requirement to use this in my program, and I'm not sure where it will go:
Input.clear(); // reset read pointer to very beginning of file
Input.seekg(0L, ios::beg);
Any help would be greatly appreciated.
#include <iostream> // include standard I/O library
#include <fstream> // include standard file library
#include <iomanip> // include IO manipulators
#include <string> // include C++ string class
#include <cctype> //
using namespace std; // access standard namespace
int main ()
{
ifstream Input;
string fileName;
// variables
char name;
char last = ' ';
int blank = 1;
I tried running it and didnt quite understand what file name im supposed to enter? I even tried putting a text file into the programs folder and it still didnt open it... Also please make your code more readable with the "code goes here" source code tags. If you could tell me a bit more i could try again
hm. That is strange. it is a .txt blank text file. I'm sorry, I dont quite know what else to tell you about that. but thank you for telling me about the code tags. feel free to try again