This is how I did my file.
ofstream outfile ("C:\\Documents and Settings\\Scott\\Desktop\\C++\\SetOutput.txt");
Type: Posts; User: DivineSlayer936
This is how I did my file.
ofstream outfile ("C:\\Documents and Settings\\Scott\\Desktop\\C++\\SetOutput.txt");
Do you mean outfile << endl; ?
This is the code in my main while loop:
Set a;
a.readFromFile(myfile);
outfile<<a;
Set d(a.readOperator(myfile));
Set result(d);
result.order();
It's all working nicely now except for one detail. When I do "outfile << "\n" it doesnt move down a line like it should? Is there another way to do this?
You really are my hero. It worked.
I changed displaySet to const in both the .h and .cpp and now it gives me the error "undefined reference to 'Set::displaySet()'". :(
Hmm.
void displaySet() const;
void Set::displaySet() const
{
cout << "{";
for(int i=1;i<=myList.getLength();i++)
Hate to bother you again, but is there any easy explanation for why it gives the error "undefined reference to 'Set::displaySet()'" when i declare that method as a const. It works when it isn't const.
Thank you so much! That works. :D
The program works fine just before I included the 2 code snippets from above. I had it printing with cout and I just wanted to get the overloading code right before I actually used it in my driver.
I get "In file included from Set.cpp"
"expected constructor, destructor, or type conversion before '&' token"
"expected `,' or `;' before '&' token"
What do I have to include?
Quick question. If I have a method to overload the << operator:
Header:
ostream& operator <<(ostream &os, const Set &s);
In the cpp:
Awesome, I managed to get it reading. My question is a different one now. My program will compile and prints out the first Set addition perfectly the way I wanted it to. Unfortunately, after the...
Thank you laserlight. That helped me fix the including errors I had. One of my main questions is about the lines "myFile >> seperator;" I've used lines such as these in my other programs but in this...
Okay I changed some of the small problems.
The errors I get when compiling are:
"In file included from Set.cpp "
"variable or field `readFromFile' declared void"
"expected `;' before '('...
Desolation: If you read properly, I state "I'm having trouble finding a way to read through multiple lines and reading the various characters into the Set class." And the question, Can you help me...
This is an insanely simple problem I'm sure. I started a c++ class with no c++ history and only java. The class started out in recursion and I've been struggling through it. I have one day to finish...