My program ask for two numbers, then see with one is bigger.

In details:

My program will ask the user to enter two numbers of any size, then I will take each digit of the first and second number, and insert it in one node of a linked list. It will appear like this:

first number = 123456789

second number = 567891234

head1->9->8->7->6->5->4->3->2->1

head2->4->3->2->1->9->8->7->6->5

Then, I will compare the two numbers, and should return 0 if head1 > head2, return 0 if head1 < head2, and return nothing if they are equal.

Don't ask me to revirse the order of entering each digit into the linked list. I just need it that way for another pourpse.

Anyway at first, I made a code to compare the 2 linked lists using Recursion normally, and here it:

bool ChckWhoNum(Node*he1,Node*he2) { bool res; if ((!he1) || (!he2)) res=0; else { if(he2->value>he1->value) res=1; else if (he2->value<he1->value) res=0; else if(he2->value==he1->value) ChckWhoNum(he1->next,he2->next); } return res; }

In my case, i need to do it in revise order. Instead of checking the linked list from the start(left) to end(right). I wanna make from the end"left" to the start"right".

I've tried a couple of time, but I always end up having a problem with the stoping condition..

I believe that I should have 2 stoping condition to make it work in my humble opinion. And currently I can't figure out the second condition. Here is my code:

bool ChckWhoNum(Node*he1,Node*he2) { bool res; if ((!he1) || (!he2)) res=0; ChckWhoNum(he1->next,he2->next); if(he2->value>he1->value) { cout<<"head2 > head1\n"; res=1; } else if (he2->value<he1->value) { cout<<"head1 > head2\n"; res=0; } }

I hope you got my point, and this could be possible.

Waiting for your response....