#include <iostream>
#include <fstream>
#include <string>
usingnamespace std;
int main()
{
//first store info in a file where we want to read it without the "\t"'s
ofstream createfile("test.txt");
createfile << "zaryabsaeed \t wants \t to \t ignore \t the \t tabs. \t why \t does \t zryabsaeed \t hate \t the \t tabs?\r\n it's \tjust \tnot \tfair. \r\nthe \ttabs \t are being \tdiscriminated \t\t against.";
createfile.close();
string filetext; //Stores all the text received from the file
ifstream readfile("test.txt");
char c; //Holds the individual character we will read from the file
readfile.read(&c, 1); //Read 1 character from the file
while (!readfile.eof()) //while not at the end of the file
{
if (c != '\t') //if character is not \t
filetext += c; //add character to our string
readfile.read(&c, 1); //get next character (if it exists)
}
readfile.close(); //close our file when we reach the end
cout << filetext << endl; //print out our file
getline(cin, filetext); //call getline to stop the program from closing automatically (not necessary)
return 0;
}
This is a good solution but i would think that it would be better to just write the psuedocode and let him figure it out. That way he would be able to remember it a little better when he runs across this issue again.