===========================================================================
CODING
#include<all.h>
void main()
{
int x,y,i,j,A,B,C;
clrscr();
first();
second();
cprintf(" (A*x)+(B*y)+C=0\r\n\r\n Enter:-\r\n A= ");
cscanf("%d",&A);
cprintf("\r\n B= ");
cscanf("%d",&B);
cprintf("\r\n C= ");
cscanf("%d",&C);
clrscr();
for(i=-11,x=7,y=12;i<=11;x=x+3,i++)
{
if(i==-11)
{
gotoxy(x+2,y);
cprintf("«");
}
else if(i==11)
{
gotoxy(x,y);
cprintf("»");
}
else
{
gotoxy(x,y);
cprintf("─┬─");
gotoxy(x,y+1);
if(i==0);
else if(i>0 && i<10)
cprintf(" %d",i);
else
cprintf("%d",i);
}
}
for(i=11,x=39,y=1;i>=-11;i--,y++)
{
gotoxy(x,y);
if(i==-11)
cprintf(" ▼ ");
else if(i==11)
cprintf(" ▲");
else
{
if(i==0)
cprintf("");
else if(i>0 && i<10)
cprintf(" %d",i);
else if(i==-10)
cprintf("\b%d",i);
else
cprintf("%d",i);
gotoxy(x+2,y);
if(i==0)
cprintf("┼");
else
cprintf("┤");
}
}
textcolor(10+BLINK);
if(B!=0)
{
for(i=-10;i<=10;i++)
{
j=-(i*A+C)/B;
if(j>=-10 && j<=10)
{
y=12-j;
x=41+3*i;
gotoxy(x,y);
cprintf("■");
delay(200);
}
}
}
else
{
for(j=-10;j<=10;j++)
{
i=-C/A;
if(i>=-10 && i<=10)
{
y=12-j;
x=41+3*i;
gotoxy(x,y);
cprintf("■");
delay(200);
}
}
}
getch();
getch();
}
CODING
#include<all.h>
void main()
{
int x,y,i,j,A,B,C;
clrscr();
first();
second();
cprintf(" (A*x)+(B*y)+C=0\r\n\r\n Enter:-\r\n A= ");
cscanf("%d",&A);
cprintf("\r\n B= ");
cscanf("%d",&B);
cprintf("\r\n C= ");
cscanf("%d",&C);
clrscr();
for(i=-11,x=7,y=12;i<=11;x=x+3,i++)
{
if(i==-11)
{
gotoxy(x+2,y);
cprintf("«");
}
else if(i==11)
{
gotoxy(x,y);
cprintf("»");
}
else
{
gotoxy(x,y);
cprintf("─┬─");
gotoxy(x,y+1);
if(i==0);
else if(i>0 && i<10)
cprintf(" %d",i);
else
cprintf("%d",i);
}
}
for(i=11,x=39,y=1;i>=-11;i--,y++)
{
gotoxy(x,y);
if(i==-11)
cprintf(" ▼ ");
else if(i==11)
cprintf(" ▲");
else
{
if(i==0)
cprintf("");
else if(i>0 && i<10)
cprintf(" %d",i);
else if(i==-10)
cprintf("\b%d",i);
else
cprintf("%d",i);
gotoxy(x+2,y);
if(i==0)
cprintf("┼");
else
cprintf("┤");
}
}
textcolor(10+BLINK);
if(B!=0)
{
for(i=-10;i<=10;i++)
{
j=-(i*A+C)/B;
if(j>=-10 && j<=10)
{
y=12-j;
x=41+3*i;
gotoxy(x,y);
cprintf("■");
delay(200);
}
}
}
else
{
for(j=-10;j<=10;j++)
{
i=-C/A;
if(i>=-10 && i<=10)
{
y=12-j;
x=41+3*i;
gotoxy(x,y);
cprintf("■");
delay(200);
}
}
}
getch();
getch();
}
===========================================================================
No comments:
Post a Comment