===========================================================================
CODING
#include<iostream.h>
#include<conio.h>
#include<dos.h>
void main()
{
clrscr();
int a[80],b[80],c[80],cx,i,j,k,n,m,r,ch,CH,X,x,y,C1,C2;
textcolor(WHITE);
gotoxy(7,3);
cprintf("MENU");
gotoxy(7,4);
cprintf("ÄÄÄÄ");
gotoxy(13,5);
cprintf("1 2");
gotoxy(1,6);
cprintf("1-> A A ³ A D");
gotoxy(1,7);
cprintf("2-> A D ³ A D");
gotoxy(1,8);
cprintf("3-> D D ³ A D");
gotoxy(1,9);
cprintf("4-> D A ³ A D");
gotoxy(3,11);
cprintf("INPUT: ");
cscanf("%d%d",&ch,&CH);
textbackground(YELLOW);
switch(ch)
{
case 1:
gotoxy(1,6);
cprintf("1-> A A");
textbackground(5);
switch(CH)
{
case 1:
gotoxy(13,6);
cprintf("A");
break;
case 2:
gotoxy(15,6);
cprintf("D");
break;
}
break;
case 2:
gotoxy(1,7);
cprintf("2-> A D");
textbackground(5);
switch(CH)
{
case 1:
gotoxy(13,7);
cprintf("A");
break;
case 2:
gotoxy(15,7);
cprintf("D");
break;
}
break;
case 3:
gotoxy(1,8);
cprintf("3-> D D");
textbackground(5);
switch(CH)
{
case 1:
gotoxy(13,8);
cprintf("A");
break;
case 2:
gotoxy(15,8);
cprintf("D");
break;
}
break;
case 4:
gotoxy(1,9);
cprintf("4-> D A");
textbackground(5);
switch(CH)
{
case 1:
gotoxy(13,9);
cprintf("A");
break;
case 2:
gotoxy(15,9);
cprintf("D");
break;
}
break;
}
getch();
getch();
textbackground(0);
switch(ch)
{
case 1: C1=C2=1;break;
case 2: C1=1;C2=2;break;
case 3: C1=C2=2;break;
case 4: C1=2;C2=1;break;
default: C1=C2=1;
}
clrscr();
gotoxy(1,1);
cprintf("Array 1:");
gotoxy(1,3);
cprintf("Enter no. of Observations: ");
cscanf("%d",&m);
cprintf("\r\nEnter Nos.:- ");
for(i=0,x=1,y=6;i<=m-1;i++,x+=5)
{
textcolor(WHITE);
if(i==0)
{
gotoxy(x,y);
cprintf("ÕÍÍÍÍ");
gotoxy(x,y+1);
cprintf("³ ");
gotoxy(x,y+2);
cprintf("ÔÍÍÍÍ");
}
else if(i==m-1)
{
gotoxy(x,y);
cprintf("ÑÍÍÍ͸");
gotoxy(x,y+1);
cprintf("³ ³");
gotoxy(x,y+2);
cprintf("ÏÍÍÍ;");
}
else
{
gotoxy(x,y);
cprintf("ÑÍÍÍÍ");
gotoxy(x,y+1);
cprintf("³ ");
gotoxy(x,y+2);
cprintf("ÏÍÍÍÍ");
}
}
for(i=0,x=3;i<=m-1;i++,x+=5)
{
gotoxy(x,7);
cscanf("%d",&a[i]);
}
switch(C1)
{
case 1:
for(i=0,x=3,y=6;i<=m-1;i++,x+=5)
{
for(j=0;j<=m-2-i;j++)
{
textcolor(BLUE);
gotoxy(x,7);
cprintf("%.2d",a[i]);
textcolor(RED);
gotoxy(5*(j+1)+x,7);
cprintf("%.2d",a[i+1+j]);
if(a[i]>a[j+1+i])
{
r=a[i];
a[i]=a[i+j+1];
a[j+i+1]=r;
}
sound(700);
delay(450);
nosound();
delay(70);
sound(700);
delay(450);
nosound();
textcolor(WHITE);
gotoxy(x,7);
cprintf("%.2d",a[i]);
gotoxy(5*(j+1)+x,7);
cprintf("%.2d",a[i+1+j]);
delay(500);
}
}
break;
case 2:
for(i=0,x=3,y=6;i<=m-1;i++,x+=5)
{
for(j=0;j<=m-2-i;j++)
{
textcolor(BLUE);
gotoxy(x,7);
cprintf("%.2d",a[i]);
textcolor(RED);
gotoxy(5*(j+1)+x,7);
cprintf("%.2d",a[i+1+j]);
if(a[i]<a[j+1+i])
{
r=a[i];
a[i]=a[i+j+1];
a[j+i+1]=r;
}
sound(700);
delay(450);
nosound();
delay(70);
sound(700);
delay(450);
nosound();
textcolor(WHITE);
gotoxy(x,7);
cprintf("%.2d",a[i]);
gotoxy(5*(j+1)+x,7);
cprintf("%.2d",a[i+1+j]);
delay(500);
}
}
break;
}
getch();
getch();
textcolor(WHITE);
gotoxy(1,10);
cprintf("Array 2:");
gotoxy(1,13);
cprintf("Enter no. of Observations: ");
cscanf("%d",&n);
cprintf("\r\nEnter Nos.:- ");
for(i=0,x=1,y=16;i<=n-1;i++,x+=5)
{
textcolor(WHITE);
if(i==0)
{
gotoxy(x,y);
cprintf("ÕÍÍÍÍ");
gotoxy(x,y+1);
cprintf("³ ");
gotoxy(x,y+2);
cprintf("ÔÍÍÍÍ");
}
else if(i==n-1)
{
gotoxy(x,y);
cprintf("ÑÍÍÍ͸");
gotoxy(x,y+1);
cprintf("³ ³");
gotoxy(x,y+2);
cprintf("ÏÍÍÍ;");
}
else
{
gotoxy(x,y);
cprintf("ÑÍÍÍÍ");
gotoxy(x,y+1);
cprintf("³ ");
gotoxy(x,y+2);
cprintf("ÏÍÍÍÍ");
}
}
for(i=0,x=3;i<=n-1;i++,x+=5)
{
gotoxy(x,17);
cscanf("%d",&b[i]);
}
switch(C2)
{
case 1:
for(i=0,x=3,y=16;i<=n-1;i++,x+=5)
{
for(j=0;j<=n-2-i;j++)
{
textcolor(BLUE);
gotoxy(x,17);
cprintf("%.2d",b[i]);
textcolor(RED);
gotoxy(5*(j+1)+x,17);
cprintf("%.2d",b[i+1+j]);
if(b[i]>b[j+1+i])
{
r=b[i];
b[i]=b[i+j+1];
b[j+i+1]=r;
}
sound(700);
delay(450);
nosound();
delay(70);
sound(700);
delay(450);
nosound();
textcolor(WHITE);
gotoxy(x,17);
cprintf("%.2d",b[i]);
gotoxy(5*(j+1)+x,17);
cprintf("%.2d",b[i+1+j]);
delay(500);
}
}
break;
case 2:
for(i=0,x=3,y=16;i<=n-1;i++,x+=5)
{
for(j=0;j<=n-2-i;j++)
{
textcolor(BLUE);
gotoxy(x,17);
cprintf("%.2d",b[i]);
textcolor(RED);
gotoxy(5*(j+1)+x,17);
cprintf("%.2d",b[i+1+j]);
if(b[i]<b[j+1+i])
{
r=b[i];
b[i]=b[i+j+1];
b[j+i+1]=r;
}
sound(700);
delay(450);
nosound();
delay(70);
sound(700);
delay(450);
nosound();
textcolor(WHITE);
gotoxy(x,17);
cprintf("%.2d",b[i]);
gotoxy(5*(j+1)+x,17);
cprintf("%.2d",b[i+1+j]);
delay(500);
}
}
break;
}
getch();
getch();
textcolor(WHITE);
gotoxy(1,20);
cprintf("RESULT:-");
for(i=0,x=1,y=22;i<=n+m-1;i++,x+=5)
{
textcolor(WHITE);
if(i==0)
{
gotoxy(x,y);
cprintf("ÕÍÍÍÍ");
gotoxy(x,y+1);
cprintf("³ ");
gotoxy(x,y+2);
cprintf("ÔÍÍÍÍ");
}
else if(i==n+m-1)
{
gotoxy(x,y);
cprintf("ÑÍÍÍ͸");
gotoxy(x,y+1);
cprintf("³ ³");
gotoxy(x,y+2);
cprintf("ÏÍÍÍ;");
}
else
{
gotoxy(x,y);
cprintf("ÑÍÍÍÍ");
gotoxy(x,y+1);
cprintf("³ ");
gotoxy(x,y+2);
cprintf("ÏÍÍÍÍ");
}
}
switch(CH)
{
case 1:
switch(C1)
{
case 1: i=0;x=3;break;
case 2: i=m-1;x=3+5*(m-1);break;
}
switch(C2)
{
case 1: j=0;X=3;break;
case 2: j=n-1;X=3+5*(n-1);break;
}
for(cx=3,k=0;k<=m+n-1;k++,cx+=5)
{
switch(C1)
{
case 1: if(i>m-1)goto label;break;
case 2: if(i<0)goto label;break;
}
switch(C2)
{
case 1: if(j>n-1)goto label;break;
case 2: if(j<0)goto label;break;
}
if(a[i]<b[j])
{
textcolor(YELLOW);
gotoxy(x,7);
cprintf("%.2d",a[i]);
c[k]=a[i];
textcolor(CYAN);
gotoxy(cx,23);
cprintf("%.2d",c[k]);
sound(700);
delay(400);
nosound();
delay(200);
sound(700);
delay(400);
nosound();
textcolor(WHITE);
gotoxy(x,7);
cprintf("%.2d",a[i]);
gotoxy(cx,23);
cprintf("%.2d",c[k]);
switch(C1)
{
case 1: i++;x+=5;break;
case 2: i--;x-=5;break;
}
}
else if(a[i]>b[j])
{
textcolor(YELLOW);
gotoxy(X,17);
cprintf("%.2d",b[j]);
c[k]=b[j];
textcolor(CYAN);
gotoxy(cx,23);
cprintf("%.2d",c[k]);
sound(700);
delay(400);
nosound();
delay(200);
sound(700);
delay(400);
nosound();
textcolor(WHITE);
gotoxy(X,17);
cprintf("%.2d",b[j]);
gotoxy(cx,23);
cprintf("%.2d",c[k]);
switch(C2)
{
case 1: j++;X+=5;break;
case 2: j--;X-=5;break;
}
}
else if(a[i]==b[j])
{
textcolor(YELLOW);
gotoxy(x,7);
cprintf("%.2d",a[i]);
c[k]=a[i];
textcolor(CYAN);
gotoxy(cx,23);
cprintf("%.2d",c[k]);
sound(700);
delay(400);
nosound();
delay(200);
sound(700);
delay(400);
nosound();
textcolor(WHITE);
gotoxy(x,7);
cprintf("%.2d",a[i]);
textcolor(WHITE);
gotoxy(cx,23);
cprintf("%.2d",c[k]);
k++;
cx+=5;
c[k]=b[j];
textcolor(YELLOW);
gotoxy(X,17);
cprintf("%.2d",b[j]);
textcolor(CYAN);
gotoxy(cx,23);
cprintf("%.2d",c[k]);
sound(700);
delay(400);
nosound();
delay(200);
sound(700);
delay(400);
nosound();
textcolor(WHITE);
gotoxy(X,17);
cprintf("%.2d",b[j]);
textcolor(WHITE);
gotoxy(cx,23);
cprintf("%.2d",c[k]);
switch(C1)
{
case 1: i++;x+=5;break;
case 2: i--;x-=5;break;
}
switch(C2)
{
case 1: j++;X+=5;break;
case 2: j--;X-=5;break;
}
}
}
label:
switch(C1)
{
case 1: if(i<m-1)
break;
case 2: if(i>0)
break;
}
{
switch(C1)
{
case 1:
for(;i<=m-1;i++,k++,x+=5,cx+=5)
{
c[k]=a[i];
textcolor(YELLOW);
gotoxy(x,7);
cprintf("%.2d",a[i]);
textcolor(CYAN);
gotoxy(cx,23);
cprintf("%.2d",c[k]);
sound(700);
delay(400);
nosound();
delay(200);
sound(700);
delay(400);
nosound();
textcolor(WHITE);
gotoxy(x,7);
cprintf("%.2d",a[i]);
gotoxy(cx,23);
cprintf("%.2d",c[k]);
}
break;
case 2:
for(;i>=0;i--,k++,x-=5)
{
c[k]=a[i];
textcolor(YELLOW);
gotoxy(x,7);
cprintf("%.2d",a[i]);
textcolor(CYAN);
gotoxy(cx,23);
cprintf("%.2d",c[k]);
sound(700);
delay(400);
nosound();
delay(200);
sound(700);
delay(400);
nosound();
textcolor(WHITE);
gotoxy(x,7);
cprintf("%.2d",a[i]);
gotoxy(cx,23);
cprintf("%.2d",c[k]);
}
break;
}
}
switch(C2)
{
case 1: if(j<n-1)
break;
case 2: if(j>0)
break;
}
{
switch(C2)
{
case 1:
for(;j<=n-1;j++,k++,X+=5,cx+=5)
{
c[k]=b[j];
textcolor(YELLOW);
gotoxy(X,17);
cprintf("%.2d",b[j]);
textcolor(CYAN);
gotoxy(cx,23);
cprintf("%.2d",c[k]);
sound(700);
delay(400);
nosound();
delay(200);
sound(700);
delay(400);
nosound();
textcolor(WHITE);
gotoxy(X,17);
cprintf("%.2d",b[j]);
gotoxy(cx,23);
cprintf("%.2d",c[k]);
}
break;
case 2:
for(;j>=0;j--,k++,X-=5)
{
c[k]=b[j];
textcolor(YELLOW);
gotoxy(X,17);
cprintf("%.2d",b[j]);
textcolor(CYAN);
gotoxy(cx,23);
cprintf("%.2d",c[k]);
sound(700);
delay(400);
nosound();
delay(200);
sound(700);
delay(400);
nosound();
textcolor(WHITE);
gotoxy(X,17);
cprintf("%.2d",b[j]);
gotoxy(cx,23);
cprintf("%.2d",c[k]);
}
break;
}
}
break;
case 2:
switch(C1)
{
case 2: i=0;x=3;break;
case 1: i=m-1;x=3+5*(m-1);break;
}
switch(C2)
{
case 2: j=0;X=3;break;
case 1: j=n-1;X=3+5*(n-1);break;
}
for(cx=3,k=0;k<=m+n-1;k++,cx+=5)
{
switch(C1)
{
case 2: if(i>m-1)goto label1;break;
case 1: if(i<0)goto label1;break;
}
switch(C2)
{
case 2: if(j>n-1)goto label1;break;
case 1: if(j<0)goto label1;break;
}
if(a[i]>b[j])
{
textcolor(YELLOW);
gotoxy(x,7);
cprintf("%.2d",a[i]);
c[k]=a[i];
textcolor(CYAN);
gotoxy(cx,23);
cprintf("%.2d",c[k]);
sound(700);
delay(400);
nosound();
delay(200);
sound(700);
delay(400);
nosound();
textcolor(WHITE);
gotoxy(x,7);
cprintf("%.2d",a[i]);
gotoxy(cx,23);
cprintf("%.2d",c[k]);
switch(C1)
{
case 2: i++;x+=5;break;
case 1: i--;x-=5;break;
}
}
else if(a[i]<b[j])
{
textcolor(YELLOW);
gotoxy(X,17);
cprintf("%.2d",b[j]);
c[k]=b[j];
textcolor(CYAN);
gotoxy(cx,23);
cprintf("%.2d",c[k]);
sound(700);
delay(400);
nosound();
delay(200);
sound(700);
delay(400);
nosound();
textcolor(WHITE);
gotoxy(X,17);
cprintf("%.2d",b[j]);
gotoxy(cx,23);
cprintf("%.2d",c[k]);
switch(C2)
{
case 2: j++;X+=5;break;
case 1: j--;X-=5;break;
}
}
else if(a[i]==b[j])
{
textcolor(YELLOW);
gotoxy(x,7);
cprintf("%.2d",a[i]);
c[k]=a[i];
textcolor(CYAN);
gotoxy(cx,23);
cprintf("%.2d",c[k]);
sound(700);
delay(400);
nosound();
delay(200);
sound(700);
delay(400);
nosound();
textcolor(WHITE);
gotoxy(x,7);
cprintf("%.2d",a[i]);
textcolor(WHITE);
gotoxy(cx,23);
cprintf("%.2d",c[k]);
k++;
cx+=5;
c[k]=b[j];
textcolor(YELLOW);
gotoxy(X,17);
cprintf("%.2d",b[j]);
textcolor(CYAN);
gotoxy(cx,23);
cprintf("%.2d",c[k]);
sound(700);
delay(400);
nosound();
delay(200);
sound(700);
delay(400);
nosound();
textcolor(WHITE);
gotoxy(X,17);
cprintf("%.2d",b[j]);
textcolor(WHITE);
gotoxy(cx,23);
cprintf("%.2d",c[k]);
switch(C1)
{
case 2: i++;x+=5;break;
case 1: i--;x-=5;break;
}
switch(C2)
{
case 2: j++;X+=5;break;
case 1: j--;X-=5;break;
}
}
}
label1:
switch(C1)
{
case 2: if(i<m-1)
break;
case 1: if(i>0)
break;
}
{
switch(C1)
{
case 2:
for(;i<=m-1;i++,k++,x+=5,cx+=5)
{
c[k]=a[i];
textcolor(YELLOW);
gotoxy(x,7);
cprintf("%.2d",a[i]);
textcolor(CYAN);
gotoxy(cx,23);
cprintf("%.2d",c[k]);
sound(700);
delay(400);
nosound();
delay(200);
sound(700);
delay(400);
nosound();
textcolor(WHITE);
gotoxy(x,7);
cprintf("%.2d",a[i]);
gotoxy(cx,23);
cprintf("%.2d",c[k]);
}
break;
case 1:
for(;i>=0;i--,k++,x-=5)
{
c[k]=a[i];
textcolor(YELLOW);
gotoxy(x,7);
cprintf("%.2d",a[i]);
textcolor(CYAN);
gotoxy(cx,23);
cprintf("%.2d",c[k]);
sound(700);
delay(400);
nosound();
delay(200);
sound(700);
delay(400);
nosound();
textcolor(WHITE);
gotoxy(x,7);
cprintf("%.2d",a[i]);
gotoxy(cx,23);
cprintf("%.2d",c[k]);
}
break;
}
}
switch(C2)
{
case 2: if(j<n-1)
break;
case 1: if(j>0)
break;
}
{
switch(C2)
{
case 2:
for(;j<=n-1;j++,k++,X+=5,cx+=5)
{
c[k]=b[j];
textcolor(YELLOW);
gotoxy(X,17);
cprintf("%.2d",b[j]);
textcolor(CYAN);
gotoxy(cx,23);
cprintf("%.2d",c[k]);
sound(700);
delay(400);
nosound();
delay(200);
sound(700);
delay(400);
nosound();
textcolor(WHITE);
gotoxy(X,17);
cprintf("%.2d",b[j]);
gotoxy(cx,23);
cprintf("%.2d",c[k]);
}
break;
case 1:
for(;j>=0;j--,k++,X-=5)
{
c[k]=b[j];
textcolor(YELLOW);
gotoxy(X,17);
cprintf("%.2d",b[j]);
textcolor(CYAN);
gotoxy(cx,23);
cprintf("%.2d",c[k]);
sound(700);
delay(400);
nosound();
delay(200);
sound(700);
delay(400);
nosound();
textcolor(WHITE);
gotoxy(X,17);
cprintf("%.2d",b[j]);
gotoxy(cx,23);
cprintf("%.2d",c[k]);
}
break;
}
}
break;
}
getch();
}
CODING
#include<iostream.h>
#include<conio.h>
#include<dos.h>
void main()
{
clrscr();
int a[80],b[80],c[80],cx,i,j,k,n,m,r,ch,CH,X,x,y,C1,C2;
textcolor(WHITE);
gotoxy(7,3);
cprintf("MENU");
gotoxy(7,4);
cprintf("ÄÄÄÄ");
gotoxy(13,5);
cprintf("1 2");
gotoxy(1,6);
cprintf("1-> A A ³ A D");
gotoxy(1,7);
cprintf("2-> A D ³ A D");
gotoxy(1,8);
cprintf("3-> D D ³ A D");
gotoxy(1,9);
cprintf("4-> D A ³ A D");
gotoxy(3,11);
cprintf("INPUT: ");
cscanf("%d%d",&ch,&CH);
textbackground(YELLOW);
switch(ch)
{
case 1:
gotoxy(1,6);
cprintf("1-> A A");
textbackground(5);
switch(CH)
{
case 1:
gotoxy(13,6);
cprintf("A");
break;
case 2:
gotoxy(15,6);
cprintf("D");
break;
}
break;
case 2:
gotoxy(1,7);
cprintf("2-> A D");
textbackground(5);
switch(CH)
{
case 1:
gotoxy(13,7);
cprintf("A");
break;
case 2:
gotoxy(15,7);
cprintf("D");
break;
}
break;
case 3:
gotoxy(1,8);
cprintf("3-> D D");
textbackground(5);
switch(CH)
{
case 1:
gotoxy(13,8);
cprintf("A");
break;
case 2:
gotoxy(15,8);
cprintf("D");
break;
}
break;
case 4:
gotoxy(1,9);
cprintf("4-> D A");
textbackground(5);
switch(CH)
{
case 1:
gotoxy(13,9);
cprintf("A");
break;
case 2:
gotoxy(15,9);
cprintf("D");
break;
}
break;
}
getch();
getch();
textbackground(0);
switch(ch)
{
case 1: C1=C2=1;break;
case 2: C1=1;C2=2;break;
case 3: C1=C2=2;break;
case 4: C1=2;C2=1;break;
default: C1=C2=1;
}
clrscr();
gotoxy(1,1);
cprintf("Array 1:");
gotoxy(1,3);
cprintf("Enter no. of Observations: ");
cscanf("%d",&m);
cprintf("\r\nEnter Nos.:- ");
for(i=0,x=1,y=6;i<=m-1;i++,x+=5)
{
textcolor(WHITE);
if(i==0)
{
gotoxy(x,y);
cprintf("ÕÍÍÍÍ");
gotoxy(x,y+1);
cprintf("³ ");
gotoxy(x,y+2);
cprintf("ÔÍÍÍÍ");
}
else if(i==m-1)
{
gotoxy(x,y);
cprintf("ÑÍÍÍ͸");
gotoxy(x,y+1);
cprintf("³ ³");
gotoxy(x,y+2);
cprintf("ÏÍÍÍ;");
}
else
{
gotoxy(x,y);
cprintf("ÑÍÍÍÍ");
gotoxy(x,y+1);
cprintf("³ ");
gotoxy(x,y+2);
cprintf("ÏÍÍÍÍ");
}
}
for(i=0,x=3;i<=m-1;i++,x+=5)
{
gotoxy(x,7);
cscanf("%d",&a[i]);
}
switch(C1)
{
case 1:
for(i=0,x=3,y=6;i<=m-1;i++,x+=5)
{
for(j=0;j<=m-2-i;j++)
{
textcolor(BLUE);
gotoxy(x,7);
cprintf("%.2d",a[i]);
textcolor(RED);
gotoxy(5*(j+1)+x,7);
cprintf("%.2d",a[i+1+j]);
if(a[i]>a[j+1+i])
{
r=a[i];
a[i]=a[i+j+1];
a[j+i+1]=r;
}
sound(700);
delay(450);
nosound();
delay(70);
sound(700);
delay(450);
nosound();
textcolor(WHITE);
gotoxy(x,7);
cprintf("%.2d",a[i]);
gotoxy(5*(j+1)+x,7);
cprintf("%.2d",a[i+1+j]);
delay(500);
}
}
break;
case 2:
for(i=0,x=3,y=6;i<=m-1;i++,x+=5)
{
for(j=0;j<=m-2-i;j++)
{
textcolor(BLUE);
gotoxy(x,7);
cprintf("%.2d",a[i]);
textcolor(RED);
gotoxy(5*(j+1)+x,7);
cprintf("%.2d",a[i+1+j]);
if(a[i]<a[j+1+i])
{
r=a[i];
a[i]=a[i+j+1];
a[j+i+1]=r;
}
sound(700);
delay(450);
nosound();
delay(70);
sound(700);
delay(450);
nosound();
textcolor(WHITE);
gotoxy(x,7);
cprintf("%.2d",a[i]);
gotoxy(5*(j+1)+x,7);
cprintf("%.2d",a[i+1+j]);
delay(500);
}
}
break;
}
getch();
getch();
textcolor(WHITE);
gotoxy(1,10);
cprintf("Array 2:");
gotoxy(1,13);
cprintf("Enter no. of Observations: ");
cscanf("%d",&n);
cprintf("\r\nEnter Nos.:- ");
for(i=0,x=1,y=16;i<=n-1;i++,x+=5)
{
textcolor(WHITE);
if(i==0)
{
gotoxy(x,y);
cprintf("ÕÍÍÍÍ");
gotoxy(x,y+1);
cprintf("³ ");
gotoxy(x,y+2);
cprintf("ÔÍÍÍÍ");
}
else if(i==n-1)
{
gotoxy(x,y);
cprintf("ÑÍÍÍ͸");
gotoxy(x,y+1);
cprintf("³ ³");
gotoxy(x,y+2);
cprintf("ÏÍÍÍ;");
}
else
{
gotoxy(x,y);
cprintf("ÑÍÍÍÍ");
gotoxy(x,y+1);
cprintf("³ ");
gotoxy(x,y+2);
cprintf("ÏÍÍÍÍ");
}
}
for(i=0,x=3;i<=n-1;i++,x+=5)
{
gotoxy(x,17);
cscanf("%d",&b[i]);
}
switch(C2)
{
case 1:
for(i=0,x=3,y=16;i<=n-1;i++,x+=5)
{
for(j=0;j<=n-2-i;j++)
{
textcolor(BLUE);
gotoxy(x,17);
cprintf("%.2d",b[i]);
textcolor(RED);
gotoxy(5*(j+1)+x,17);
cprintf("%.2d",b[i+1+j]);
if(b[i]>b[j+1+i])
{
r=b[i];
b[i]=b[i+j+1];
b[j+i+1]=r;
}
sound(700);
delay(450);
nosound();
delay(70);
sound(700);
delay(450);
nosound();
textcolor(WHITE);
gotoxy(x,17);
cprintf("%.2d",b[i]);
gotoxy(5*(j+1)+x,17);
cprintf("%.2d",b[i+1+j]);
delay(500);
}
}
break;
case 2:
for(i=0,x=3,y=16;i<=n-1;i++,x+=5)
{
for(j=0;j<=n-2-i;j++)
{
textcolor(BLUE);
gotoxy(x,17);
cprintf("%.2d",b[i]);
textcolor(RED);
gotoxy(5*(j+1)+x,17);
cprintf("%.2d",b[i+1+j]);
if(b[i]<b[j+1+i])
{
r=b[i];
b[i]=b[i+j+1];
b[j+i+1]=r;
}
sound(700);
delay(450);
nosound();
delay(70);
sound(700);
delay(450);
nosound();
textcolor(WHITE);
gotoxy(x,17);
cprintf("%.2d",b[i]);
gotoxy(5*(j+1)+x,17);
cprintf("%.2d",b[i+1+j]);
delay(500);
}
}
break;
}
getch();
getch();
textcolor(WHITE);
gotoxy(1,20);
cprintf("RESULT:-");
for(i=0,x=1,y=22;i<=n+m-1;i++,x+=5)
{
textcolor(WHITE);
if(i==0)
{
gotoxy(x,y);
cprintf("ÕÍÍÍÍ");
gotoxy(x,y+1);
cprintf("³ ");
gotoxy(x,y+2);
cprintf("ÔÍÍÍÍ");
}
else if(i==n+m-1)
{
gotoxy(x,y);
cprintf("ÑÍÍÍ͸");
gotoxy(x,y+1);
cprintf("³ ³");
gotoxy(x,y+2);
cprintf("ÏÍÍÍ;");
}
else
{
gotoxy(x,y);
cprintf("ÑÍÍÍÍ");
gotoxy(x,y+1);
cprintf("³ ");
gotoxy(x,y+2);
cprintf("ÏÍÍÍÍ");
}
}
switch(CH)
{
case 1:
switch(C1)
{
case 1: i=0;x=3;break;
case 2: i=m-1;x=3+5*(m-1);break;
}
switch(C2)
{
case 1: j=0;X=3;break;
case 2: j=n-1;X=3+5*(n-1);break;
}
for(cx=3,k=0;k<=m+n-1;k++,cx+=5)
{
switch(C1)
{
case 1: if(i>m-1)goto label;break;
case 2: if(i<0)goto label;break;
}
switch(C2)
{
case 1: if(j>n-1)goto label;break;
case 2: if(j<0)goto label;break;
}
if(a[i]<b[j])
{
textcolor(YELLOW);
gotoxy(x,7);
cprintf("%.2d",a[i]);
c[k]=a[i];
textcolor(CYAN);
gotoxy(cx,23);
cprintf("%.2d",c[k]);
sound(700);
delay(400);
nosound();
delay(200);
sound(700);
delay(400);
nosound();
textcolor(WHITE);
gotoxy(x,7);
cprintf("%.2d",a[i]);
gotoxy(cx,23);
cprintf("%.2d",c[k]);
switch(C1)
{
case 1: i++;x+=5;break;
case 2: i--;x-=5;break;
}
}
else if(a[i]>b[j])
{
textcolor(YELLOW);
gotoxy(X,17);
cprintf("%.2d",b[j]);
c[k]=b[j];
textcolor(CYAN);
gotoxy(cx,23);
cprintf("%.2d",c[k]);
sound(700);
delay(400);
nosound();
delay(200);
sound(700);
delay(400);
nosound();
textcolor(WHITE);
gotoxy(X,17);
cprintf("%.2d",b[j]);
gotoxy(cx,23);
cprintf("%.2d",c[k]);
switch(C2)
{
case 1: j++;X+=5;break;
case 2: j--;X-=5;break;
}
}
else if(a[i]==b[j])
{
textcolor(YELLOW);
gotoxy(x,7);
cprintf("%.2d",a[i]);
c[k]=a[i];
textcolor(CYAN);
gotoxy(cx,23);
cprintf("%.2d",c[k]);
sound(700);
delay(400);
nosound();
delay(200);
sound(700);
delay(400);
nosound();
textcolor(WHITE);
gotoxy(x,7);
cprintf("%.2d",a[i]);
textcolor(WHITE);
gotoxy(cx,23);
cprintf("%.2d",c[k]);
k++;
cx+=5;
c[k]=b[j];
textcolor(YELLOW);
gotoxy(X,17);
cprintf("%.2d",b[j]);
textcolor(CYAN);
gotoxy(cx,23);
cprintf("%.2d",c[k]);
sound(700);
delay(400);
nosound();
delay(200);
sound(700);
delay(400);
nosound();
textcolor(WHITE);
gotoxy(X,17);
cprintf("%.2d",b[j]);
textcolor(WHITE);
gotoxy(cx,23);
cprintf("%.2d",c[k]);
switch(C1)
{
case 1: i++;x+=5;break;
case 2: i--;x-=5;break;
}
switch(C2)
{
case 1: j++;X+=5;break;
case 2: j--;X-=5;break;
}
}
}
label:
switch(C1)
{
case 1: if(i<m-1)
break;
case 2: if(i>0)
break;
}
{
switch(C1)
{
case 1:
for(;i<=m-1;i++,k++,x+=5,cx+=5)
{
c[k]=a[i];
textcolor(YELLOW);
gotoxy(x,7);
cprintf("%.2d",a[i]);
textcolor(CYAN);
gotoxy(cx,23);
cprintf("%.2d",c[k]);
sound(700);
delay(400);
nosound();
delay(200);
sound(700);
delay(400);
nosound();
textcolor(WHITE);
gotoxy(x,7);
cprintf("%.2d",a[i]);
gotoxy(cx,23);
cprintf("%.2d",c[k]);
}
break;
case 2:
for(;i>=0;i--,k++,x-=5)
{
c[k]=a[i];
textcolor(YELLOW);
gotoxy(x,7);
cprintf("%.2d",a[i]);
textcolor(CYAN);
gotoxy(cx,23);
cprintf("%.2d",c[k]);
sound(700);
delay(400);
nosound();
delay(200);
sound(700);
delay(400);
nosound();
textcolor(WHITE);
gotoxy(x,7);
cprintf("%.2d",a[i]);
gotoxy(cx,23);
cprintf("%.2d",c[k]);
}
break;
}
}
switch(C2)
{
case 1: if(j<n-1)
break;
case 2: if(j>0)
break;
}
{
switch(C2)
{
case 1:
for(;j<=n-1;j++,k++,X+=5,cx+=5)
{
c[k]=b[j];
textcolor(YELLOW);
gotoxy(X,17);
cprintf("%.2d",b[j]);
textcolor(CYAN);
gotoxy(cx,23);
cprintf("%.2d",c[k]);
sound(700);
delay(400);
nosound();
delay(200);
sound(700);
delay(400);
nosound();
textcolor(WHITE);
gotoxy(X,17);
cprintf("%.2d",b[j]);
gotoxy(cx,23);
cprintf("%.2d",c[k]);
}
break;
case 2:
for(;j>=0;j--,k++,X-=5)
{
c[k]=b[j];
textcolor(YELLOW);
gotoxy(X,17);
cprintf("%.2d",b[j]);
textcolor(CYAN);
gotoxy(cx,23);
cprintf("%.2d",c[k]);
sound(700);
delay(400);
nosound();
delay(200);
sound(700);
delay(400);
nosound();
textcolor(WHITE);
gotoxy(X,17);
cprintf("%.2d",b[j]);
gotoxy(cx,23);
cprintf("%.2d",c[k]);
}
break;
}
}
break;
case 2:
switch(C1)
{
case 2: i=0;x=3;break;
case 1: i=m-1;x=3+5*(m-1);break;
}
switch(C2)
{
case 2: j=0;X=3;break;
case 1: j=n-1;X=3+5*(n-1);break;
}
for(cx=3,k=0;k<=m+n-1;k++,cx+=5)
{
switch(C1)
{
case 2: if(i>m-1)goto label1;break;
case 1: if(i<0)goto label1;break;
}
switch(C2)
{
case 2: if(j>n-1)goto label1;break;
case 1: if(j<0)goto label1;break;
}
if(a[i]>b[j])
{
textcolor(YELLOW);
gotoxy(x,7);
cprintf("%.2d",a[i]);
c[k]=a[i];
textcolor(CYAN);
gotoxy(cx,23);
cprintf("%.2d",c[k]);
sound(700);
delay(400);
nosound();
delay(200);
sound(700);
delay(400);
nosound();
textcolor(WHITE);
gotoxy(x,7);
cprintf("%.2d",a[i]);
gotoxy(cx,23);
cprintf("%.2d",c[k]);
switch(C1)
{
case 2: i++;x+=5;break;
case 1: i--;x-=5;break;
}
}
else if(a[i]<b[j])
{
textcolor(YELLOW);
gotoxy(X,17);
cprintf("%.2d",b[j]);
c[k]=b[j];
textcolor(CYAN);
gotoxy(cx,23);
cprintf("%.2d",c[k]);
sound(700);
delay(400);
nosound();
delay(200);
sound(700);
delay(400);
nosound();
textcolor(WHITE);
gotoxy(X,17);
cprintf("%.2d",b[j]);
gotoxy(cx,23);
cprintf("%.2d",c[k]);
switch(C2)
{
case 2: j++;X+=5;break;
case 1: j--;X-=5;break;
}
}
else if(a[i]==b[j])
{
textcolor(YELLOW);
gotoxy(x,7);
cprintf("%.2d",a[i]);
c[k]=a[i];
textcolor(CYAN);
gotoxy(cx,23);
cprintf("%.2d",c[k]);
sound(700);
delay(400);
nosound();
delay(200);
sound(700);
delay(400);
nosound();
textcolor(WHITE);
gotoxy(x,7);
cprintf("%.2d",a[i]);
textcolor(WHITE);
gotoxy(cx,23);
cprintf("%.2d",c[k]);
k++;
cx+=5;
c[k]=b[j];
textcolor(YELLOW);
gotoxy(X,17);
cprintf("%.2d",b[j]);
textcolor(CYAN);
gotoxy(cx,23);
cprintf("%.2d",c[k]);
sound(700);
delay(400);
nosound();
delay(200);
sound(700);
delay(400);
nosound();
textcolor(WHITE);
gotoxy(X,17);
cprintf("%.2d",b[j]);
textcolor(WHITE);
gotoxy(cx,23);
cprintf("%.2d",c[k]);
switch(C1)
{
case 2: i++;x+=5;break;
case 1: i--;x-=5;break;
}
switch(C2)
{
case 2: j++;X+=5;break;
case 1: j--;X-=5;break;
}
}
}
label1:
switch(C1)
{
case 2: if(i<m-1)
break;
case 1: if(i>0)
break;
}
{
switch(C1)
{
case 2:
for(;i<=m-1;i++,k++,x+=5,cx+=5)
{
c[k]=a[i];
textcolor(YELLOW);
gotoxy(x,7);
cprintf("%.2d",a[i]);
textcolor(CYAN);
gotoxy(cx,23);
cprintf("%.2d",c[k]);
sound(700);
delay(400);
nosound();
delay(200);
sound(700);
delay(400);
nosound();
textcolor(WHITE);
gotoxy(x,7);
cprintf("%.2d",a[i]);
gotoxy(cx,23);
cprintf("%.2d",c[k]);
}
break;
case 1:
for(;i>=0;i--,k++,x-=5)
{
c[k]=a[i];
textcolor(YELLOW);
gotoxy(x,7);
cprintf("%.2d",a[i]);
textcolor(CYAN);
gotoxy(cx,23);
cprintf("%.2d",c[k]);
sound(700);
delay(400);
nosound();
delay(200);
sound(700);
delay(400);
nosound();
textcolor(WHITE);
gotoxy(x,7);
cprintf("%.2d",a[i]);
gotoxy(cx,23);
cprintf("%.2d",c[k]);
}
break;
}
}
switch(C2)
{
case 2: if(j<n-1)
break;
case 1: if(j>0)
break;
}
{
switch(C2)
{
case 2:
for(;j<=n-1;j++,k++,X+=5,cx+=5)
{
c[k]=b[j];
textcolor(YELLOW);
gotoxy(X,17);
cprintf("%.2d",b[j]);
textcolor(CYAN);
gotoxy(cx,23);
cprintf("%.2d",c[k]);
sound(700);
delay(400);
nosound();
delay(200);
sound(700);
delay(400);
nosound();
textcolor(WHITE);
gotoxy(X,17);
cprintf("%.2d",b[j]);
gotoxy(cx,23);
cprintf("%.2d",c[k]);
}
break;
case 1:
for(;j>=0;j--,k++,X-=5)
{
c[k]=b[j];
textcolor(YELLOW);
gotoxy(X,17);
cprintf("%.2d",b[j]);
textcolor(CYAN);
gotoxy(cx,23);
cprintf("%.2d",c[k]);
sound(700);
delay(400);
nosound();
delay(200);
sound(700);
delay(400);
nosound();
textcolor(WHITE);
gotoxy(X,17);
cprintf("%.2d",b[j]);
gotoxy(cx,23);
cprintf("%.2d",c[k]);
}
break;
}
}
break;
}
getch();
}
===========================================================================
No comments:
Post a Comment