Okay so I think n and p makes it that there's 2 separate structures declared for 'positive' and negative numbers, but I'm trying to figure out how do I pass the structures by reference.
Like in x_positive I want to calc the 'counter' and the 'total' of the pos/neg #'s I passed.
example:
code:
void x_positive( anum, structure& p? ) {
c++; t = t + anum;
PrintCat();
}
Like if the variables are already declared in the struct catstates, how do I get it so that they're passed right? I thought func( num, catstats& p )
posted
I'm not sure if you still need the help, but here's two things that are coming to mind in your code. In your function I don't think you are actually changing any members of p. I'm not totally sure why this would compile in the first place, but you should be doing p.c++ and p.t+= anum or some such thing.
Also, what is x_negative going that requires a separate function?
Posts: 2437 | Registered: Apr 2005
| IP: Logged |
posted
Not according to the code you posted. There's no check anywhere to ensure that only positive numbers get passed to x_positive. What's this code supposed to do, anyway?
Posts: 10645 | Registered: Jul 2004
| IP: Logged |
Blayne Bradley
unregistered
posted
i passed psuodo code, I only wanted help with passing structures, and it works fine now, im onto version 5ish now out of 6.
IP: Logged |