Can someone please help me to create a circular reference
I need to add a to b and b to a. I've been looking everywhere can this be accomplished with enum or structs?

Please help me

describe your problem in brief..!

two values are used to calculate each other
e.g a = b + c
b = a + d
this is called a circular reference.

Run this and tell me it's not working...

int a, b, c, d;
        a = 10;
        b = 15;
        c = 12;
        d = 14;

        a = b + c;
        b = a + d;

        Response.Write("value of a : " + a + "<br />");
        Response.Write("value of b : " + b + "<br />");

you see, a should use b's final answer and b should use a's final answer.

my b is using a's final answer..
could you be kind to run this code..
and setup a debug...and see the values..

my answers are:
a = 27
b = 41

you assigned 15 to b and 12 to c = 27
I need the e.g(41) for b

dude B is returning 41...
i'm not sure wot is your problem..?

wot should be your expected output..
after my calculation..

wot do u expect the value a & b?

with these answers:
a = 27
b = 41

the calculation should then be
a = 41 + 12
b = 27 + 14

no it's not gonna happen
cos you are changing the B's value after a's calculation..

int a, b, c, d;
        a = 10;
        b = 15;
        c = 12;
        d = 14;

        a = b + c;
        b = a + d;
       [B] a = b + c;[/B]


        Response.Write("value of a : " + a + "<br />");
        Response.Write("value of b : " + b + "<br />");

add this lil modification...
one last question..do u know wot u doin bro..!

No that won't work, what I'm trying to do is called circular reference where values depend on each other in a calculation.

no u r not showing me ur cards..
tell me wt u trying 2 do ..?

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.