Gives 12, 2 Will Be Stored, and 1 Will Be A Carry
Gives 12, 2 Will Be Stored, and 1 Will Be A Carry
class double_list{
node *head;
node*last;
public:
double_list ()
{head=NULL;
last=NULL;
}
void insertatfirst(int x);
void insertatlast(int x);
double_list add(node *last)\\ add the two lists and then return the resultant list
void display();
}
write a main function , ask the user to enter a number ( a long integer) and then
break this integer into its constituents digits and each digit will be stored as a data of
a node. For example a user enters
123456789 a long integer
1
2
3
4
5
6
7
8
9
constituents digits
hea
head
456213
3
gives 12, 2 will
be stored , and 1
will be a carry
After addition
hea
1 carry