# Practical Problems - II

Posted by Jayakumars under ASP.NET AJAX on 8/28/2014 | Points: 10 | Views : 1225 | Status : [Member] [MVP] | Replies : 1
1.Inner And Outer View Of A House
2.Cartoon Using Circle,Ellipse And Arc

3.Piechart And Bargraph Using Pieslice And Bar
Bar Graph In Three Dimensions

4.Two- Dimensional Transformations

5.Reflect A Triangle W.R.T X-Axis

6.Animate Any Two- Dimensional Object

7.Ball Bouncing Using Random Number

8.Ball Bouncing Using Random Number

Mark as Answer if its helpful to you

Kumaraspcode2009@gmail.com

#### Responses

Posted by: Jayakumars on: 8/28/2014 [Member] [MVP] Bronze | Points: 25
 0 ```#include #include #include #include #include #include #include class lines { private: int length,x1,y1,x2,y2,x,y,dx,dy,wx,wy,w,width; public: lines(); //Constructor void showline(); int sign(int); }; int lines::sign(int xx) { if(xx<0) return -1; if(xx==0) return 0; if(xx>0) return 1; return 0; } lines::lines() { x=0;y=0; cout<<"Enter The Co-Ordinates (x1,y1) ":="; cin>>x1>>y1; cout<<"Enter The Co-Ordinates (x2,y2) ":="; cin>>x2>>y2; cout<<"Enter The Width Of The Line ":="; cin>>width; } void lines::showline() { char *s,*s1; if(abs(x2-x1)>=abs(y2-y1)) length=abs(x2-x1); else length=abs(y2-y1); w=width; wx=((w-1)/2)*(sqrt((x2-x1)*(x2-x1)+(y2-y1)*(y2-y1))/abs(y2-y1)); wy=((w-1)/2)*(sqrt((x2-x1)*(x2-x1)+(y2-y1)*(y2-y1))/abs(x2-x1)); dx=(x2-x1)/length; dy=(y2-y1)/length; if(dy>dx) wy=wx; x=x1+0.5*sign(dx); y=y1+0.5*sign(dy); int i=1; setcolor(0); while(i<=length) { for(int j=0;j=6;i++,j--) { xx+=10; outtextxy(xx,10,mess[i]); xxx-=10; outtextxy(xxx,10,mess[j]); delay(100); } for(i=130;i<=510;i+=10) for(j=50;j<=430;j+=10) putpixel(i,j,15); for(i=130;i<=510;i+=10) { if(i==320) continue; outtextxy(i,237,"+"); } for(i=50;i<=430;i+=10) { if(i==240) continue; outtextxy(317,i,"-"); } outtextxy(310,230,"O"); outtextxy(530,240,"X"); outtextxy(320,450,"-Y"); outtextxy(100,240,"-X"); outtextxy(320,30,"Y"); a.showline(); closegraph(); } #include #include #include main() { int gd = DETECT, gm, area, temp1, temp2, left = 25, top = 75; void *p; initgraph(&gd,&gm,"C:\\TC\\BGI"); setcolor(YELLOW); circle(50,100,25); setfillstyle(SOLID_FILL,YELLOW); floodfill(50,100,YELLOW); setcolor(BLACK); setfillstyle(SOLID_FILL,BLACK); fillellipse(44,85,2,6); fillellipse(56,85,2,6); ellipse(50,100,205,335,20,9); ellipse(50,100,205,335,20,10); ellipse(50,100,205,335,20,11); area = imagesize(left, top, left + 50, top + 50); p = malloc(area); setcolor(WHITE); settextstyle(SANS_SERIF_FONT,HORIZ_DIR,2); outtextxy(155,451,"Smiling Face Animation"); setcolor(BLUE); rectangle(0,0,639,449); while(!kbhit()) { temp1 = 1 + random ( 588 ); temp2 = 1 + random ( 380 ); getimage(left, top, left + 50, top + 50, p); putimage(left, top, p, XOR_PUT); putimage(temp1 , temp2, p, XOR_PUT); delay(100); left = temp1; top = temp2; } getch(); closegraph(); return 0; } #include #include main() { int gd = DETECT, gm; initgraph(&gd, &gm, "C:\\TC\\BGI"); setcolor(YELLOW); rectangle(0,30,639,450); settextstyle(SANS_SERIF_FONT,HORIZ_DIR,2); setcolor(WHITE); outtextxy(275,0,"Bar Chart"); setlinestyle(SOLID_LINE,0,2); line(100,420,100,60); line(100,420,600,420); line(90,70,100,60); line(110,70,100,60); line(590,410,600,420); line(590,430,600,420); outtextxy(95,35,"Y"); outtextxy(610,405,"X"); outtextxy(85,415,"O"); setfillstyle(LINE_FILL,BLUE); bar(150,100,200,419); setfillstyle(XHATCH_FILL,RED); bar(225,150,275,419); setfillstyle(WIDE_DOT_FILL,GREEN); bar(300,200,350,419); setfillstyle(INTERLEAVE_FILL,MAGENTA); bar(375,125,425,419); setfillstyle(HATCH_FILL,BROWN); bar(450,175,500,419); getch(); return 0; } pie chart #include #include int main() { int gd = DETECT, gm, midx, midy; initgraph(&gd, &gm, "C:\\TC\\BGI"); setcolor(MAGENTA); rectangle(0,40,639,450); settextstyle(SANS_SERIF_FONT,HORIZ_DIR,2); setcolor(WHITE); outtextxy(275,10,"Pie Chart"); midx = getmaxx()/2; midy = getmaxy()/2; setfillstyle(LINE_FILL,BLUE); pieslice(midx, midy, 0, 75, 100); outtextxy(midx+100, midy - 75, "20.83%"); setfillstyle(XHATCH_FILL,RED); pieslice(midx, midy, 75, 225, 100); outtextxy(midx-175, midy - 75, "41.67%"); setfillstyle(WIDE_DOT_FILL,GREEN); pieslice(midx, midy, 225, 360, 100); outtextxy(midx+75, midy + 75, "37.50%"); getch(); return 0; } #include #include int main() { int gd = DETECT, gm; initgraph(&gd, &gm, "C:\\TC\\BGI"); setcolor(YELLOW); rectangle(0,30,639,450); settextstyle(SANS_SERIF_FONT,HORIZ_DIR,2); setcolor(WHITE); outtextxy(275,0,"Bar Chart"); setlinestyle(SOLID_LINE,0,2); line(100,420,100,60); line(100,420,600,420); line(90,70,100,60); line(110,70,100,60); line(590,410,600,420); line(590,430,600,420); outtextxy(95,35,"Y"); outtextxy(610,405,"X"); outtextxy(85,415,"O"); setfillstyle(LINE_FILL,BLUE); bar(150,100,200,419); setfillstyle(XHATCH_FILL,RED); bar(225,150,275,419); setfillstyle(WIDE_DOT_FILL,GREEN); bar(300,200,350,419); setfillstyle(INTERLEAVE_FILL,MAGENTA); bar(375,125,425,419); setfillstyle(HATCH_FILL,BROWN); bar(450,175,500,419); getch(); return 0; } #include #include #include #include #include #include int i,j,k=0,n,a[10],ta[10],tx,ty,x; float r,deg; void main() { int gd=DETECT,gm; initgraph(&gd,&gm,"d:\\tc\\bgi"); setbkcolor(2); cout<<"Enter The x1&y1,x2&y2 values(4)"; cin>>n; for(i=0;i>a[k++]; } a[k]=a[Mark as Answer if its helpful to you Kumaraspcode2009@gmail.comJayakumars, if this helps please login to Mark As Answer. | Alert Moderator```
Latest Posts