0% found this document useful (0 votes)
31 views1 page

Gives 12, 2 Will Be Stored, and 1 Will Be A Carry

A simple LAB ASSIGNMENT of Data Structure which is a programming assignment on C++ and you can practice your knowledge

Uploaded by

Adnan Ali
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
31 views1 page

Gives 12, 2 Will Be Stored, and 1 Will Be A Carry

A simple LAB ASSIGNMENT of Data Structure which is a programming assignment on C++ and you can practice your knowledge

Uploaded by

Adnan Ali
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 1

Q1.

Create a doubly linked list using the following class definition


struct node{
int d;
node *next;
node *prev;};

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

Note:- Do it in your respective groups


The name of group members should be written as comments in the CPP file
Submit its soft copy by 1300hrs on 10th October 2014
email:[email protected]

You might also like