Esempio n. 1
0
void main()
{
	DLL l;
	int data,pos,ch=0;

	while(ch!=6)
	{
		cout<<"\n\n---DLL ops---\n";
		cout<<"\n1.display";
		cout<<"\n2.Insert";
		cout<<"\n3.Delete";
		cout<<"\n4.Insert sort";
		cout<<"\n5.Display Reverse";
		cout<<"\n6.Exit";
		cout<<"Enter the choice";
		cin>>ch;
		switch(ch)
		{
		case 1:
			cout<<l;
			break;
		case 2:
			cout<<"\n\nEnter the data";
			cin>>data;
			cout<<"\nEnter the position";
			cin>>pos;
			l.InsertPos(data,pos);
			break;
		case 3:
			cout<<"\nEnter the position";
			cin>>pos;
			l.DeletePos(pos);
			break;
		case 4:
			cout<<"\nEnter the data\n";
			cin>>data;
			l.InsertSorted(data);
			break;
		case 5:
			l.dis_rev();
			break;

		}

	}
	
}
Esempio n. 2
0
void main()
{
	int pos,ch;
	Emp e;

	DLL l;
	while(ch!=4)
	{
		cout<<"\n\n---DLL---\n";
		cout<<"\n1.display";
		cout<<"\n2.Insert Position";
		cout<<"\n";
		cout<<"\n4.exit";
		cout<<"\nEnter the choice:";
		cin>>ch;
		switch(ch)
		{
		case 1:
			l.display();
			break;
		case 2:
			cout<<"\nEnter the info";
			cin>>e;
			cout<<"\nEnter the position:";
			cin>>pos;
			l.InsertPos(e,pos);
			break;
		case 3:
			cout<<"\nEnter the position:";
			cin>>pos;
			l.DeletePos(pos);
			break;
		}
	}

}