===========================================================================
CODING
#include<iostream.h>
#include<conio.h>
void main()
{
clrscr();
int i,j,n,m,x,y,a[80][80],ch,b[80][80];
textcolor(WHITE);
cprintf("Enter Rows and Columns: ");
cscanf("%d%d",&m,&n);
cprintf("\r\nEnter Values:-");
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(5,15);
textcolor(RED+BLINK);
cprintf("Press any Key to Continue...");
getch();
textcolor(CYAN);
gotoxy(x+3,6);
cprintf(" þ ");
gotoxy(x+3,7);
cprintf(" þþþ ");
gotoxy(x+3,8);
cprintf("þþþþþþþþþ ");
gotoxy(x+3,9);
cprintf(" þþþ ");
gotoxy(x+3,10);
cprintf(" þ ");
textcolor(YELLOW);
for(i=0,y=5;i<m;i++,y+=2)
{
for(j=0,x=40;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(ch=1;ch<=5;ch++)
{
for(i=0,y=6;i<m;i++,y+=2)
{
for(j=0,x=42;j<n;j++,x+=5)
{
gotoxy(x,y);
cprintf(" ");
b[i][j]=a[i][j];
}
}
for(i=0,y=6;i<m;i++,y+=2)
{
for(j=0,x=42;j<n;j++,x+=5)
{
gotoxy(x,y);
switch(ch)
{
case 1:
if(i+j>m-1)
b[i][j]=0;
break;
case 2:
if(i<j)
b[i][j]=0;
break;
case 3:
if(i>j)
b[i][j]=0;
break;
case 4:
if(i+j<m-1)
b[i][j]=0;
break;
default:
if(i==m-1 ||i==0)
if(j==0 || j==n-1)
b[i][j]=0;
}
cprintf("%d",b[i][j]);
}
}
getch();
}
}
CODING
#include<iostream.h>
#include<conio.h>
void main()
{
clrscr();
int i,j,n,m,x,y,a[80][80],ch,b[80][80];
textcolor(WHITE);
cprintf("Enter Rows and Columns: ");
cscanf("%d%d",&m,&n);
cprintf("\r\nEnter Values:-");
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(5,15);
textcolor(RED+BLINK);
cprintf("Press any Key to Continue...");
getch();
textcolor(CYAN);
gotoxy(x+3,6);
cprintf(" þ ");
gotoxy(x+3,7);
cprintf(" þþþ ");
gotoxy(x+3,8);
cprintf("þþþþþþþþþ ");
gotoxy(x+3,9);
cprintf(" þþþ ");
gotoxy(x+3,10);
cprintf(" þ ");
textcolor(YELLOW);
for(i=0,y=5;i<m;i++,y+=2)
{
for(j=0,x=40;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(ch=1;ch<=5;ch++)
{
for(i=0,y=6;i<m;i++,y+=2)
{
for(j=0,x=42;j<n;j++,x+=5)
{
gotoxy(x,y);
cprintf(" ");
b[i][j]=a[i][j];
}
}
for(i=0,y=6;i<m;i++,y+=2)
{
for(j=0,x=42;j<n;j++,x+=5)
{
gotoxy(x,y);
switch(ch)
{
case 1:
if(i+j>m-1)
b[i][j]=0;
break;
case 2:
if(i<j)
b[i][j]=0;
break;
case 3:
if(i>j)
b[i][j]=0;
break;
case 4:
if(i+j<m-1)
b[i][j]=0;
break;
default:
if(i==m-1 ||i==0)
if(j==0 || j==n-1)
b[i][j]=0;
}
cprintf("%d",b[i][j]);
}
}
getch();
}
}
===========================================================================
No comments:
Post a Comment