Re: Trees as Linked Lists
Unless you make an actual, mutual interaction between nodes, you won't be able to build anything on your own; No one is helping you except you
Re: Trees as Linked Lists
Quote:
mutual interaction
What's that?
Quote:
Originally Posted by Jeneo W.
I want to create a function >>> void add_formula(ff *p1);
so as to the user can enter data.
well, you already know how to assign a pointer
Code:
#include <iostream>
namespace demo
{
std::ostream& os = std::cout;
struct formula
{
explicit
formula(const int i = 0)
:
next(0),
previous(0),
id(i)
{
}
formula* next;
formula* previous;
int id;
};
struct mixer
{
mixer()
: pointer(0)
{
}
void add_formula(formula* p)
{
pointer = p;
os << "Formula id ( " << p->id << " ) added\n";
}
formula* pointer;
};
} // end namespace
int main()
{
{
using namespace demo;
formula f(66);
formula f2(77);
mixer m;
m.add_formula(&f);
m.add_formula(&f2);
}
}
Or do I silently hear you having trouble with other stuff you haven't said yet?