===========================================================================
CODING
#include<iostream.h>
#include<conio.h>
#include<math.h>
#include<stdio.h>
#include<process.h>
#include<dos.h>
void main()
{
clrscr();
int b[80],k,j,i,n,r,x,y,m,a[80][80],ch;
textcolor(WHITE);
cprintf("Enter Rows and Columns: ");
cscanf("%d%d",&m,&n);
cprintf("\r\nEnter Vlaues:-");
textcolor(YELLOW);
for(i=0,y=5;i<m;i++,y+=2)
{
for(j=0,x=5;j<n;j++,x+=5)
{
gotoxy(x,y);
if(i==0 && j==0)
cprintf("ÕÍÍÍÍ");
else if(i==0 && j==n-1)
cprintf("ÑÍÍÍ͸");
else if(i==0)
cprintf("ÑÍÍÍÍ");
gotoxy(x,y+1);
if(j==n-1)
cprintf("³ ³");
else
cprintf("³ ");
gotoxy(x,y+2);
if(i==m-1 && j==0)
cprintf("ÔÍÍÍÍ");
else if(i==m-1 && j==n-1)
cprintf("ÏÍÍÍ;");
else if(i==m-1)
cprintf("ÏÍÍÍÍ");
else if(j==0)
cprintf("ÆÍÍÍÍ");
else if(j==n-1)
cprintf("ØÍÍÍ͵");
else
cprintf("ØÍÍÍÍ");
}
}
textcolor(BLUE);
for(i=0,y=6;i<m;i++,y+=2)
{
for(j=0,x=7;j<n;j++,x+=5)
{
gotoxy(x,y);
cscanf("%d",&a[i][j]);
}
}
getch();
gotoxy(1,15);
textcolor(RED+BLINK);
cprintf("Press any Key to Continue...");
getch();
gotoxy(1,15);
cprintf(" ");
textcolor(CYAN);
x=-2;
gotoxy(x+3,18);
cprintf(" þ ");
gotoxy(x+3,19);
cprintf(" þþþ ");
gotoxy(x+3,20);
cprintf("þþþþþþþþþ ");
gotoxy(x+3,21);
cprintf(" þþþ ");
gotoxy(x+3,22);
cprintf(" þ ");
textcolor(BLUE);
for(i=0,k=0,y=6;i<m;i++,y+=2)
{
for(j=0,x=42;j<n;j++,x+=5,k++)
{
b[k]=a[i][j];
}
}
for(i=0,x=13,y=19;i<=k-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==k-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(j=0,x=15;j<=k-1;j++)
{
for(i=0,y=19;i<=k-2-j;i++)
{
textcolor(5);
gotoxy(x+5*(i),20);
cprintf("%.2d",b[i]);
textcolor(YELLOW);
gotoxy(x+5*(i+1),20);
cprintf("%.2d",b[i+1]);
if(b[i]>b[i+1])
{
r=b[i];
b[i]=b[i+1];
b[i+1]=r;
}
sound(300);
delay(1500);
nosound();
textcolor(WHITE);
gotoxy(x+5*(i),20);
cprintf("%.2d",b[i]);
gotoxy(5*(i+1)+x,20);
cprintf("%.2d",b[i+1]);
}
}
getch();
}
CODING
#include<iostream.h>
#include<conio.h>
#include<math.h>
#include<stdio.h>
#include<process.h>
#include<dos.h>
void main()
{
clrscr();
int b[80],k,j,i,n,r,x,y,m,a[80][80],ch;
textcolor(WHITE);
cprintf("Enter Rows and Columns: ");
cscanf("%d%d",&m,&n);
cprintf("\r\nEnter Vlaues:-");
textcolor(YELLOW);
for(i=0,y=5;i<m;i++,y+=2)
{
for(j=0,x=5;j<n;j++,x+=5)
{
gotoxy(x,y);
if(i==0 && j==0)
cprintf("ÕÍÍÍÍ");
else if(i==0 && j==n-1)
cprintf("ÑÍÍÍ͸");
else if(i==0)
cprintf("ÑÍÍÍÍ");
gotoxy(x,y+1);
if(j==n-1)
cprintf("³ ³");
else
cprintf("³ ");
gotoxy(x,y+2);
if(i==m-1 && j==0)
cprintf("ÔÍÍÍÍ");
else if(i==m-1 && j==n-1)
cprintf("ÏÍÍÍ;");
else if(i==m-1)
cprintf("ÏÍÍÍÍ");
else if(j==0)
cprintf("ÆÍÍÍÍ");
else if(j==n-1)
cprintf("ØÍÍÍ͵");
else
cprintf("ØÍÍÍÍ");
}
}
textcolor(BLUE);
for(i=0,y=6;i<m;i++,y+=2)
{
for(j=0,x=7;j<n;j++,x+=5)
{
gotoxy(x,y);
cscanf("%d",&a[i][j]);
}
}
getch();
gotoxy(1,15);
textcolor(RED+BLINK);
cprintf("Press any Key to Continue...");
getch();
gotoxy(1,15);
cprintf(" ");
textcolor(CYAN);
x=-2;
gotoxy(x+3,18);
cprintf(" þ ");
gotoxy(x+3,19);
cprintf(" þþþ ");
gotoxy(x+3,20);
cprintf("þþþþþþþþþ ");
gotoxy(x+3,21);
cprintf(" þþþ ");
gotoxy(x+3,22);
cprintf(" þ ");
textcolor(BLUE);
for(i=0,k=0,y=6;i<m;i++,y+=2)
{
for(j=0,x=42;j<n;j++,x+=5,k++)
{
b[k]=a[i][j];
}
}
for(i=0,x=13,y=19;i<=k-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==k-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(j=0,x=15;j<=k-1;j++)
{
for(i=0,y=19;i<=k-2-j;i++)
{
textcolor(5);
gotoxy(x+5*(i),20);
cprintf("%.2d",b[i]);
textcolor(YELLOW);
gotoxy(x+5*(i+1),20);
cprintf("%.2d",b[i+1]);
if(b[i]>b[i+1])
{
r=b[i];
b[i]=b[i+1];
b[i+1]=r;
}
sound(300);
delay(1500);
nosound();
textcolor(WHITE);
gotoxy(x+5*(i),20);
cprintf("%.2d",b[i]);
gotoxy(5*(i+1)+x,20);
cprintf("%.2d",b[i+1]);
}
}
getch();
}
===========================================================================
No comments:
Post a Comment