That was quick. I'm just a beginner so to understand it i hv to take time. great work.
The typedef map<> is in the library or user define. And i havent study map so, i barely understand it. In this case i m forced to use bintree.
Im trying with the ostream and istream now. This is my attempt
Code:
struct words
{
string s;
words() : s(" ") {}
words(const string st) : s(st) {}
friend ostream &operator<< (ostream &stream, words word);
friend istream &operator>> (istream &stream, words &word);
};
ostream &operator>> (ostream &stream, words word)
{
stream << word.s;
return stream;
}
istream &operator<< (istream &stream, words &word)
{
stream >> word.s;
return stream;
}
I read by file so i use getline for reading the string and put it into istream
Code:
while (fin.good())
{
getline(fin, temp);
words w(temp);
cout << w;
}
now i can work ... just print out text file