我要加入 登录
声振论坛 返回首页

huright的个人空间 http://home.vibunion.com/?19755 [收藏] [复制] [分享] [RSS]

日志

单叶双曲面(C语言)

已有 387 次阅读2007-5-24 21:30 |个人分类:关注学习

单叶双曲面(C语言)源代码

CODE:

#include <graphics.h>
#include <math.h>
#include <stdio.h>
#define pi 3.1415926
void main()
{
int graphdrive=DETECT,graphmode;
int X[36],Y[36],x[36],y[36],i;
float angle1,angle2,R1,R2,R,H;
printf("Please input the radius of the ceil circle=R1(0~160):\n");
scanf("%f",&R1);
printf("Please input the radius of the bottom circle=R2(0~160):\n");
scanf("%f",&R2);
printf("Please input the radius of tht throat circle=R:\n");
scanf("%f",&R);
if(R>R1||R>R2)
{
printf("Yous input is ERROR!\n");
return;
}
printf("Please the height of the bin-surface=H:\n");
scanf("%f",&H);
initgraph(&graphdrive,&graphmode,"");
angle2=acos(R/R1)+acos(R/R2);
cleardevice();
setbkcolor(9);
setcolor(15);
setlinestyle(CENTER_LINE,2,NORM_WIDTH);
line(160,25,160,500);
line(25,400,300,400);
setcolor(4);
setlinestyle(SOLID_LINE,0,THICK_WIDTH);
line(160-R1,280,160+R1,280);
line(160-R2,280-H,160+R2,280-H);
circle(160,400,R1);
circle(160,400,R2);
circle(160,400,R);
setcolor(2);
setlinestyle(SOLID_LINE,0,NORM_WIDTH);
i=1;
do{
angle1=pi/18*i;
x[i]=160+(R1*cos(angle1));
X[i]=160+(R2*cos(angle1+angle2));
y[i]=400+(R1*sin(angle1));
Y[i]=400+(R2*sin(angle1+angle2));
line(x[i],y[i],X[i],Y[i]);
line(x[i],280,X[i],280-H);
i++;
}
while(i<=36);
getch();
closegraph();
}


未命名4.bmp

评论 (0 个评论)

facelist doodle 涂鸦板

您需要登录后才可以评论 登录 | 我要加入

QQ|小黑屋|Archiver|手机版|联系我们|声振论坛

GMT+8, 2024-5-20 06:04 , Processed in 0.031907 second(s), 16 queries , Gzip On.

Powered by Discuz! X3.4

Copyright © 2001-2021, Tencent Cloud.

返回顶部