===========================================================================
CODING
#include<iostream.h>
#include<conio.h>
#include<process.h>
#include<all.h>
void main()
{
clrscr();
first();
second();
int a[100],ch,pos,x,y,add,i,j,k,b[100];
a[0]=500;
for(j=0;j<=20;j++)
b[j]=1;
while(1==1)
{
gotoxy(28,1);
cprintf("BEST PERFORMANCE PROGRAM");
gotoxy(28,2);
cprintf("ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ");
gotoxy(38,10);
cprintf("Menu");
gotoxy(38,11);
cprintf("ÄÄÄÄ");
gotoxy(25,13);
cprintf("ADD AT: Begining->1");
gotoxy(40,14);
cprintf("End->2");
gotoxy(40,15);
cprintf("Position->3");
gotoxy(25,17);
cprintf("DELET AT: Begining->4");
gotoxy(40,18);
cprintf("End->5");
gotoxy(40,19);
cprintf("Position->6");
gotoxy(25,21);
cprintf("REVERSE->7");
gotoxy(25,23);
cprintf("EXIT->8");
gotoxy(35,25);
cprintf("Your Choice: ");
cscanf("%d",&ch);
switch(ch)
{
case 1:
gotoxy(60,13);
cprintf("Add: ");
cscanf("%d",&add);
for(j=0;b[j-1]!=500;j++)
{
if(j==0)
b[j]=add;
else if(j>0)
b[j]=a[j-1];
}
break;
case 2:
gotoxy(60,14);
cprintf("Add: ");
cscanf("%d",&add);
for(j=0;b[j]!=500;j++)
{
if(a[j]==500)
{
b[j]=add;
b[j+1]=500;
}
else
b[j]=a[j];
}
break;
case 3:
gotoxy(60,15);
cprintf("Add: ");
cscanf("%d",&add);
label:
gotoxy(70,15);
cprintf("At: ");
cscanf("%d",&pos);
if(pos<0)
{
gotoxy(74,15);
cprintf(" ");
goto label;
}
/* for(j=0;pos!=j;j++)
{
if(a[j]==500)
{
a[j]=0;
a[j+1]=500;
}
}*/
for(j=0;b[j-1]!=500;j++)
{
if(j==pos)
b[j]=add;
else if(j>pos)
b[j]=a[j-1];
else
b[j]=a[j];
}
break;
case 4:
for(j=0;b[j-1]!=500;j++)
{
b[j]=a[j+1];
}
break;
case 5:
for(j=0;b[j-1]!=500;j++)
{
if(a[j+1]==500)
b[j]=500;
else
b[j]=a[j];
}
break;
case 6:
label1:
gotoxy(60,19);
cprintf("At: ");
cscanf("%d",&pos);
if(pos<0)
{
gotoxy(64,19);
cprintf(" ");
goto label1;
}
for(j=0;b[j-1]!=500;j++)
{
if(j>=pos)
b[j]=a[j+1];
else
b[j]=a[j];
}
break;
case 7:
for(j=0;a[j]!=500;j++);
for(k=j-1,j=0;b[j-1]!=500;j++,k--)
{
if(k==-1)
b[j]=500;
else
b[j]=a[k];
}
break;
default: exit(0);
}
for(j=0;b[j-1]!=500;j++)
a[j]=b[j];
for(j=0,x=1,y=5;a[j]!=500;j++,x+=5)
{
gotoxy(x+2,y-1);
cprintf("%d",j);
if(a[1]==500)
{
gotoxy(x,y);
cprintf("ÕÍÍÍ͸");
gotoxy(x,y+1);
cprintf("³ ³");
gotoxy(x+2,y+1);
cprintf("%.2d",a[j]);
gotoxy(x,y+2);
cprintf("ÔÍÍÍ;");
}
else
{
if(j==0)
{
gotoxy(x,y);
cprintf("ÕÍÍÍÍ");
gotoxy(x,y+1);
cprintf("³ ");
gotoxy(x+2,y+1);
cprintf("%.2d",a[j]);
gotoxy(x,y+2);
cprintf("ÔÍÍÍÍ");
}
else if(a[j+1]==500)
{
gotoxy(x,y);
cprintf("ÑÍÍÍ͸");
gotoxy(x,y+1);
cprintf("³ ³");
gotoxy(x+2,y+1);
cprintf("%.2d",a[j]);
gotoxy(x,y+2);
cprintf("ÏÍÍÍ;");
}
else
{
gotoxy(x,y);
cprintf("ÑÍÍÍÍ");
gotoxy(x,y+1);
cprintf("³ ");
gotoxy(x+2,y+1);
cprintf("%.2d",a[j]);
gotoxy(x,y+2);
cprintf("ÏÍÍÍÍ");
}
}
}
getch();
getch();
clrscr();
for(j=0;j<=20;j++)
b[j]=1;
}
}
CODING
#include<iostream.h>
#include<conio.h>
#include<process.h>
#include<all.h>
void main()
{
clrscr();
first();
second();
int a[100],ch,pos,x,y,add,i,j,k,b[100];
a[0]=500;
for(j=0;j<=20;j++)
b[j]=1;
while(1==1)
{
gotoxy(28,1);
cprintf("BEST PERFORMANCE PROGRAM");
gotoxy(28,2);
cprintf("ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ");
gotoxy(38,10);
cprintf("Menu");
gotoxy(38,11);
cprintf("ÄÄÄÄ");
gotoxy(25,13);
cprintf("ADD AT: Begining->1");
gotoxy(40,14);
cprintf("End->2");
gotoxy(40,15);
cprintf("Position->3");
gotoxy(25,17);
cprintf("DELET AT: Begining->4");
gotoxy(40,18);
cprintf("End->5");
gotoxy(40,19);
cprintf("Position->6");
gotoxy(25,21);
cprintf("REVERSE->7");
gotoxy(25,23);
cprintf("EXIT->8");
gotoxy(35,25);
cprintf("Your Choice: ");
cscanf("%d",&ch);
switch(ch)
{
case 1:
gotoxy(60,13);
cprintf("Add: ");
cscanf("%d",&add);
for(j=0;b[j-1]!=500;j++)
{
if(j==0)
b[j]=add;
else if(j>0)
b[j]=a[j-1];
}
break;
case 2:
gotoxy(60,14);
cprintf("Add: ");
cscanf("%d",&add);
for(j=0;b[j]!=500;j++)
{
if(a[j]==500)
{
b[j]=add;
b[j+1]=500;
}
else
b[j]=a[j];
}
break;
case 3:
gotoxy(60,15);
cprintf("Add: ");
cscanf("%d",&add);
label:
gotoxy(70,15);
cprintf("At: ");
cscanf("%d",&pos);
if(pos<0)
{
gotoxy(74,15);
cprintf(" ");
goto label;
}
/* for(j=0;pos!=j;j++)
{
if(a[j]==500)
{
a[j]=0;
a[j+1]=500;
}
}*/
for(j=0;b[j-1]!=500;j++)
{
if(j==pos)
b[j]=add;
else if(j>pos)
b[j]=a[j-1];
else
b[j]=a[j];
}
break;
case 4:
for(j=0;b[j-1]!=500;j++)
{
b[j]=a[j+1];
}
break;
case 5:
for(j=0;b[j-1]!=500;j++)
{
if(a[j+1]==500)
b[j]=500;
else
b[j]=a[j];
}
break;
case 6:
label1:
gotoxy(60,19);
cprintf("At: ");
cscanf("%d",&pos);
if(pos<0)
{
gotoxy(64,19);
cprintf(" ");
goto label1;
}
for(j=0;b[j-1]!=500;j++)
{
if(j>=pos)
b[j]=a[j+1];
else
b[j]=a[j];
}
break;
case 7:
for(j=0;a[j]!=500;j++);
for(k=j-1,j=0;b[j-1]!=500;j++,k--)
{
if(k==-1)
b[j]=500;
else
b[j]=a[k];
}
break;
default: exit(0);
}
for(j=0;b[j-1]!=500;j++)
a[j]=b[j];
for(j=0,x=1,y=5;a[j]!=500;j++,x+=5)
{
gotoxy(x+2,y-1);
cprintf("%d",j);
if(a[1]==500)
{
gotoxy(x,y);
cprintf("ÕÍÍÍ͸");
gotoxy(x,y+1);
cprintf("³ ³");
gotoxy(x+2,y+1);
cprintf("%.2d",a[j]);
gotoxy(x,y+2);
cprintf("ÔÍÍÍ;");
}
else
{
if(j==0)
{
gotoxy(x,y);
cprintf("ÕÍÍÍÍ");
gotoxy(x,y+1);
cprintf("³ ");
gotoxy(x+2,y+1);
cprintf("%.2d",a[j]);
gotoxy(x,y+2);
cprintf("ÔÍÍÍÍ");
}
else if(a[j+1]==500)
{
gotoxy(x,y);
cprintf("ÑÍÍÍ͸");
gotoxy(x,y+1);
cprintf("³ ³");
gotoxy(x+2,y+1);
cprintf("%.2d",a[j]);
gotoxy(x,y+2);
cprintf("ÏÍÍÍ;");
}
else
{
gotoxy(x,y);
cprintf("ÑÍÍÍÍ");
gotoxy(x,y+1);
cprintf("³ ");
gotoxy(x+2,y+1);
cprintf("%.2d",a[j]);
gotoxy(x,y+2);
cprintf("ÏÍÍÍÍ");
}
}
}
getch();
getch();
clrscr();
for(j=0;j<=20;j++)
b[j]=1;
}
}
===========================================================================