Graphics Examples: // Program 2 void main() { int x1,x2,y1,y2,x1i,x2i,y1i,y2i; int count; //first line starts at: x1=20; y1=20; //first line stops at: y2=400; x2=400; //starts change by x1i=14; y1i=2; //stops change by y2i=-12; x2i=-15; count=0; while(count<20) { moveto(x1,y1); lineto(x2,y2); x1=x1+x1i; y1=y1+y1i; x2=x2+x2i; y2=y2+y2i; count=count+1; } } //------------------------------------------------- // Program 3: Graphic Function void DrawShape(int x, int y, int size) { int scale; scale=size*0.1; circle(x,y,size); moveto(x-size,y-size); lineto(x+(scale*4),y+(scale*4)); rectangle(x,y,x+size,y+size); } void main() { DrawShape(30,30,20); DrawShape(80,100,40); DrawShape(230,170,70); DrawShape(150,60,30); } //-------------------------------------------------------------------------------- // Program 4 void striangle(int x1, int y1, int x2, int y2, int x3, int y3, int level) { moveto(x1,y1); lineto(x2,y2); lineto(x3,y3); lineto(x1,y1); if(level<1) return; striangle(x1,y1,((x1)+x2)/2,((y1)+y2)/2,((x1)+x3)/2,((y1)+y3)/2,level-1); striangle(x2,y2,(x2+x1)/2,(y2+y1)/2,(x2+x3)/2,(y2+y3)/2,level-1); striangle(x3,y3,(x3+x1)/2,(y3+y1)/2,(x3+x2)/2,(y3+y2)/2,level-1); } void main() { striangle(300,5,20,305,580,305,6); }