fork download
  1. #include<stdio.h>
  2. #include<conio.h>
  3. #include<graphics.h>
  4. #include<process.h>
  5.  
  6. int drawhouse(float hx[],float hy[])
  7. { int i;
  8. int cx=getmaxx()/2;
  9. int cy=getmaxy()/2;
  10. for(i=0;i<4;i++)
  11. line(cx+hx[i],cy-hy[i],cx+hx[i+1],cy-hy[i+1]);
  12. line(cx+hx[4],cy-hy[4],cx+hx[0],cy-hy[0]);
  13. }
  14. void initscreen(float hx[],float hy[])
  15. { line(0,getmaxy()/2,getmaxx(),getmaxy()/2);
  16. line(getmaxx()/2,0,getmaxx()/2,getmaxy());
  17. drawhouse(hx,hy);
  18. }
  19.  
  20. void main()
  21. { int gd=DETECT,gm,ch,i,px,py,lx1,lx2,ly1,ly2;
  22. float sx,sy,mx,my,x,y,m,c,thx[5],thy[5];
  23. float hx[]={40.0,10.0,10.0,70.0,70.0};
  24. float hy[]={80.0,50.0,10.0,10.0,50.0};
  25. initgraph(&gd,&gm,"c:\tc");
  26. initscreen(hx,hy);
  27. do
  28. { printf("\nEnter the choice from below");
  29. printf("\n1.Scale wrt 0,0");
  30. printf("\n2.Scale wrt arb pt");
  31. printf("\n3.reflect abt pt");
  32. printf("\n4.exit");
  33. scanf("%d",&ch);
  34. switch(ch)
  35. { case 1: cleardevice();
  36. initscreen(hx,hy);
  37. for(i=0;i<=4;i++)
  38. { thx[i]=hx[i];
  39. thy[i]=hy[i];
  40. }
  41. printf("\nEnter the scale value of x and y axis");
  42. scanf("%f%f",&sx,&sy);
  43. for(i=0;i<=4;i++)
  44. { thx[i]=thx[i]*sx;
  45. thy[i]=thy[i]*sy;
  46. }
  47. drawhouse(thx,thy);
  48. break;
  49.  
  50. case 2: cleardevice();
  51. initscreen(hx,hy);
  52. for(i=0;i<=4;i++)
  53. { thx[i]=hx[i];
  54. thy[i]=hy[i];
  55. }
  56. printf("\nEnter the ref point");
  57. scanf("%d%d",&px,&py);
  58. printf("\nEnter the scale value of x and y axis");
  59. scanf("%f%f",&sx,&sy);
  60. for(i=0;i<=4;i++)
  61. { thx[i]-=px;
  62. thy[i]-=py;
  63. }
  64. for(i=0;i<=4;i++)
  65. { thx[i]=thx[i]*sx;
  66. thy[i]=thy[i]*sy;
  67. }
  68. for(i=0;i<=4;i++)
  69. { thx[i]+=px;
  70. thy[i]+=py;
  71. }
  72. drawhouse(thx,thy);
  73. break;
  74.  
  75. case 3: cleardevice();
  76. initscreen(hx,hy);
  77. printf("\nEnter the line with m amd c value");
  78. scanf("%f%f",&m,&c);
  79. if(m>0||m<0)
  80. { lx1=0;
  81. ly1=c;
  82. lx2=(getmaxy()-c)/m;
  83. ly2=getmaxy();
  84. }
  85. if(m==0)
  86. { lx1=0;
  87. ly1=c;
  88. lx2=getmaxx();
  89. ly2=c;
  90. }
  91. if(m>=9999)
  92. { lx1=lx2=c;
  93. ly1=0;
  94. ly2=getmaxy();
  95. }
  96. for(i=0;i<=4;i++)
  97. { thx[i]=hx[i];
  98. thy[i]=hy[i];
  99. }
  100. for(i=0;i<=4;i++)
  101. { x=thx[i];
  102. y=thy[i];
  103. if(m==0)
  104. { thx[i]=x;
  105. thy[i]=c+(c-y);
  106. }
  107. if(m>0||m<0)
  108. { thx[i]=2*((m*m*y+x)-c*m*m)/((1+m*m)*m)-x;
  109. thy[i]=2*(c+m*m*y+x)/(1+m*m)-y;
  110. }
  111. if(m>=9999)
  112. { thy[i]=y;
  113. thx[i]=c+(c-x);
  114. }
  115. }
  116. drawhouse(thx,thy);
  117.  
  118. line(getmaxx()/2+lx1,getmaxy()/2-ly1,getmaxx()/2+lx2,getmaxy()/2-ly2);
  119. break;
  120.  
  121. case 4: exit(1);
  122. }
  123. }while(ch!=4);
  124. }
  125.  
Compilation error #stdin compilation error #stdout 0s 0KB
stdin
Standard input is empty
compilation info
Translating:
prog.icn:
File prog.icn; Line 6 # "int": invalid declaration
1 error
stdout
Standard output is empty