Code:
#include<iostream>
using namespace std;
struct node
{
int data;
node *next;
node *pre;
};
node *head=NULL;
node *create()
{
node *newnode=new node;
cout<<"Enter Data:";
cin>>newnode->data;
newnode->next=NULL;
newnode->pre=NULL;
return newnode;
}
insertatend()
{
node *temp=head;
node *newnode=create();
if(head==NULL)
{
head=newnode;
//return newnode;
}
else
{
while(temp->next!=NULL)
temp=temp->next;
temp->next=newnode;
newnode->pre=temp;
newnode=temp;
}
}
print()
{
node* temp=head;
cout<<endl<<"List:";
while(temp!=NULL)
{
cout<<" "<<temp->data;
temp=temp->next;
}
}
printx()
{
node* temp=head;
node* newnode;
cout<<endl<<"\nTable :\n";
while(temp!=NULL)
{
for(int d=1;d<11;d++)
for(int x=0;x<1;x++)
{
cout<<"\n"<<temp->data<<" X "<<d<<" = "<<temp->data*d;
} temp=temp->next;cout<<endl;
}
}
main()
{
cout<<"How many Table You want to see:";
int d;
cin>>d;
for(int x=0;x<d;x++)
insertatend();print();printx();
cout<<"\nDo You Want To Continue\n\nPress y/n......\n\n";
char c;
cin>>c;
if(c=='n')
exit(0);
system("pause");
system("cls");
main();
}
Output:
0 Comments