Confusingness at its best (to me at least)
Yes, I'm using visual studio .net 2003 and this is a project I'm working on and this one constant error keeps buggin the crap out of me
Well, we're basically trying to make an STL list (not completely the same though) that has two different sets of pointers one to each the age before/after, and the same with name (ordered in ascending age and alphabetical name) Anyways, there's a printMode variable we have that can determine whether we print forward/backward by name/age. So there's four different print variables, with default of print forward/name.
Here's the code I'm having trouble with it seems
List::List( ) {
printMode = 1;
fName=0;
rName=0;
fAge=0;
rAge=0;
}
void PrintForward(void) {
if (printMode == 3)
printMode = 1;
else if (printMode == 4)
printMode = 2;
else if (printMode == 2)
printMode = 2;
else if (printMode == 2)
printMode = 1;
return;
}
class List {
Node *fName, *rName; // ptr to first and last Node (by Name)
Node *fAge, *rAge; // ptr to first and last Node (by Age)
int printMode; <
Well, we're basically trying to make an STL list (not completely the same though) that has two different sets of pointers one to each the age before/after, and the same with name (ordered in ascending age and alphabetical name) Anyways, there's a printMode variable we have that can determine whether we print forward/backward by name/age. So there's four different print variables, with default of print forward/name.
Here's the code I'm having trouble with it seems
List::List( ) {
printMode = 1;
fName=0;
rName=0;
fAge=0;
rAge=0;
}
void PrintForward(void) {
if (printMode == 3)
printMode = 1;
else if (printMode == 4)
printMode = 2;
else if (printMode == 2)
printMode = 2;
else if (printMode == 2)
printMode = 1;
return;
}
class List {
Node *fName, *rName; // ptr to first and last Node (by Name)
Node *fAge, *rAge; // ptr to first and last Node (by Age)
int printMode; <
[Error: Irreparable invalid markup ('<variable [...] ostream&>') in entry. Owner must fix manually. Raw contents below.]
Yes, I'm using visual studio .net 2003 and this is a project I'm working on and this one constant error keeps buggin the crap out of me
<lj-cut text="Explanation">Well, we're basically trying to make an STL list (not completely the same though) that has two different sets of pointers one to each the age before/after, and the same with name (ordered in ascending age and alphabetical name) Anyways, there's a printMode variable we have that can determine whether we print forward/backward by name/age. So there's four different print variables, with default of print forward/name.
Here's the code I'm having trouble with it seems
List::List( ) {
printMode = 1;
fName=0;
rName=0;
fAge=0;
rAge=0;
}
void PrintForward(void) {
if (printMode == 3)
printMode = 1;
else if (printMode == 4)
printMode = 2;
else if (printMode == 2)
printMode = 2;
else if (printMode == 2)
printMode = 1;
return;
}
class List {
Node *fName, *rName; // ptr to first and last Node (by Name)
Node *fAge, *rAge; // ptr to first and last Node (by Age)
int printMode; <<variable I'm trying to fix
Now the list class is a friend of a class that is class NODE (same goes for overloaded output operator) that I have, and whenever I try to compile the code, i get these two errors.
c:\Documents and Settings\Administrator\My Documents\Visual Studio Projects\cs 124 project6\10456904List.cpp(228): error C2065: 'printMode' : undeclared identifier
c:\Documents and Settings\Administrator\My Documents\Visual Studio Projects\cs 124 project6\10456904List.cpp(229): error C3861: 'printMode': identifier not found, even with argument-dependent lookup
I'm still not sure why it's not recognizing the printMode initialization (second error found in all my print functions that change the variable depending on whats called).
Any help? Thanks.
EDIT:
ostream& operator<<(ostream& os, const List& a) {
Node *temporary;
if (printMode == 1) {
temporary = a.fName;
os << temporary;
temporary = temporary->nName;
}
if (printMode == 2) {
temporary = a.fAge;
os << temporary;
temporary = temporary->nAge;
}
if (printMode == 3) {
temporary = a.rName;
os << temporary;
temporary = temporary->pName;
}
if (printMode == 4) {
temporary = a.rAge;
os << temporary;
temporary = temporary->pAge;
}
return os;
}
c:\Documents and Settings\Administrator\My Documents\Visual Studio Projects\cs 124 project6\10456904List.cpp(279): error C3861: 'printMode': identifier not found, even with argument-dependent lookup
c:\Documents and Settings\Administrator\My Documents\Visual Studio Projects\cs 124 project6\10456904List.cpp(274): error C2065: 'printMode' : undeclared identifier
I'm getting these two errors in my overloaded output operator now. I wouldnt think you had to scope it since it was a friend, right? Not sure, this is the last step before i can get down to testing this.</lj-cut>
<lj-cut text="Explanation">Well, we're basically trying to make an STL list (not completely the same though) that has two different sets of pointers one to each the age before/after, and the same with name (ordered in ascending age and alphabetical name) Anyways, there's a printMode variable we have that can determine whether we print forward/backward by name/age. So there's four different print variables, with default of print forward/name.
Here's the code I'm having trouble with it seems
List::List( ) {
printMode = 1;
fName=0;
rName=0;
fAge=0;
rAge=0;
}
void PrintForward(void) {
if (printMode == 3)
printMode = 1;
else if (printMode == 4)
printMode = 2;
else if (printMode == 2)
printMode = 2;
else if (printMode == 2)
printMode = 1;
return;
}
class List {
Node *fName, *rName; // ptr to first and last Node (by Name)
Node *fAge, *rAge; // ptr to first and last Node (by Age)
int printMode; <<variable I'm trying to fix
Now the list class is a friend of a class that is class NODE (same goes for overloaded output operator) that I have, and whenever I try to compile the code, i get these two errors.
c:\Documents and Settings\Administrator\My Documents\Visual Studio Projects\cs 124 project6\10456904List.cpp(228): error C2065: 'printMode' : undeclared identifier
c:\Documents and Settings\Administrator\My Documents\Visual Studio Projects\cs 124 project6\10456904List.cpp(229): error C3861: 'printMode': identifier not found, even with argument-dependent lookup
I'm still not sure why it's not recognizing the printMode initialization (second error found in all my print functions that change the variable depending on whats called).
Any help? Thanks.
EDIT:
ostream& operator<<(ostream& os, const List& a) {
Node *temporary;
if (printMode == 1) {
temporary = a.fName;
os << temporary;
temporary = temporary->nName;
}
if (printMode == 2) {
temporary = a.fAge;
os << temporary;
temporary = temporary->nAge;
}
if (printMode == 3) {
temporary = a.rName;
os << temporary;
temporary = temporary->pName;
}
if (printMode == 4) {
temporary = a.rAge;
os << temporary;
temporary = temporary->pAge;
}
return os;
}
c:\Documents and Settings\Administrator\My Documents\Visual Studio Projects\cs 124 project6\10456904List.cpp(279): error C3861: 'printMode': identifier not found, even with argument-dependent lookup
c:\Documents and Settings\Administrator\My Documents\Visual Studio Projects\cs 124 project6\10456904List.cpp(274): error C2065: 'printMode' : undeclared identifier
I'm getting these two errors in my overloaded output operator now. I wouldnt think you had to scope it since it was a friend, right? Not sure, this is the last step before i can get down to testing this.</lj-cut>
