#include
#include
#include
#include
#include
sphere ()
{
int appx,appy,appx1,appy1,h,majlen,minlen;
setcolor(15);
cout<<"\n\t start point";
cin>>appx>>appy;
cout<<"\n\t height";
cin>>h;
cout<<"\n\t major axis length";
cin>>majlen;
cout<<"\n\t minor axis length";
cin>>minlen;
appx1=appx;
appy1=appy+h;
line(appx,appy,appx1,appy1);
ellipse(appx1,appy1,0,360,majlen,minlen);
int x1,y1,x2,y2;
x1=appx1-majlen;
y1=appy1;
x2=appx1+majlen;
y2=appy1;
line(x1,y1,appx,appy);
line(x2,y2,appx,appy);
line(x1+majlen-10,y1-minlen,appx,appy);
line(x2-majlen+10,y1+minlen,appx,appy);
arc(appx1,appy1,180,0,majlen);
getch();
return(0);
}
void main()
{
int gd=DETECT,gm;
initgraph(&gd,&gm,"C:\\TC\\BGI");
int ch;
while(1)
{
clrscr();
cleardevice();
cout<<"\n 3d objects";
cout<<"\n";
cout<<"\n menu";
cout<<"\n";
cout<<"\n";
cout<<"\n 1.sphere";
cout<<"\n 2.exit";
cout<<"\n enter the choice";
cin>>ch;
switch(ch)
{
case 1:
sphere();
break;
case 2:
closegraph();
exit(0);
break;
}}}
No comments:
Post a Comment