Untitled
unknown
plain_text
2 years ago
877 B
1
Indexable
Never
#include<graphics.h> #include<conio.h> #include<stdio.h> int main() { int gd=DETECT,gm; int x,y,dqp,dsp,sp,q,dq,i,dp; int a1,a2,b1,b2,c1,c2,EQprice; char str[25]; initgraph(&gd, &gm,"C:\\turboc3\\bgi"); x=getmaxx()/2; y=getmaxy()/2; setcolor(3); line(x,y,x,0); line(x,y,x+500,y); outtextxy(x-10,y,"0"); outtextxy(x+300,y+2,"Q"); outtextxy(x-10,y-200,"P"); // Supply curve sp=y-20; dsp=4; q=x+10; dq=10; for(i=0;i<150;i++) { putpixel(q,sp,CYAN); q=q+dq; sp=sp-dsp; } //Demand Curve dp=y-200; dqp=6; q=x+10; dq=10; for(i=0;i<150;i++) { putpixel(q,dp,WHITE); q=q+dq; dp=dp+dqp; } // As per given points of line a1=10;b1=-4;c1=-160; a2=10;b2=6;c2=-1940; EQprice=((c1*a2-c2*a1)/((a1*b2)-(a2*b1))); sprintf(str,"Equivalent price=%d",EQprice); setcolor(GREEN); outtextxy(x-200,y-100,str); getch(); closegraph(); return 0; }