中国IT动力,最新最全的IT技术教程
最新100篇 | 推荐100篇 | 专题100篇 | 排行榜 | 搜索 | 在线API文档 | 网通镜像
首 页 | 程序开发 | 操作系统 | 软件应用 | 图形图象 | 网络应用 | 精文荟萃 | 教育认证 | 硬件维护 | 未整理篇 | 站长教程
ASP JS PHP工程 ASP.NET 网站建设 UML J2EESUN .NET VC VB VFP 网络维护 数据库 DB2 SQL2000 Oracle Mysql
服务器 Win2000 Office C DreamWeaver FireWorks Flash PhotoShop 上网宝典 CorelDraw 协议大全 网络安全 微软认证
硬件维护  CPU  主板  硬盘  内存  显卡  显示器  键盘鼠标  声卡音箱  打印机  机箱电源  BIOS  网卡  C#  Java  Delphi  vs.net2005
  当前位置:> 程序开发 > 编程语言 > Visual C++ > 高级用户界面
关于杠杆长度变化的问题(C问题)
作者:jimobuzai 时间:2001-10-01 09:50 出处:互联网 责编:chinaitpower
              摘要:关于杠杆长度变化的问题(C问题)

关于杠杆长度变化的问题

在运行时,我想不让连接圆和矩形的杠杆长度不变。

#include <graphics.h>
#include <math.h>
#define PI 3.1415926
#define A 50
#define B 180
int main()
{
 double a,b,c,x=230,y=200,file1=0,cx,bx,by;
 int gdriver, gmode,e,i,k;
 gdriver=DETECT;
/* registerbgidriver(EGAVGA_driver);  */
 initgraph(&gdriver, &gmode, "");
 setbkcolor(2);
 cleardevice();
do{
 file1+=5;
 a=A*cos(file1*PI/180);
 b=A*sin(file1*PI/180);
 c=(double)sqrt(B*B-b*b);
 bx=400-A*cos(file1*PI/180);
 by=300-A*sin(file1*PI/180);
 cx=bx-a-c;
 setcolor(4);
 line(cx,300,bx,by);
 line(bx,by,400,300);
 rectangle(cx-20,290,cx+20,310);
 circle(400,300,50);
 circle(400,300,2);
 circle(cx,300,2);
 circle(bx,by,2);
 line(80,311,345,311);
 {
  line(400,300,390,311);
  line(400,300,410,311);
  line(380,311,422,311);
 }
 for(k=0;k<=40;k+=5)
  line(383+k,311,379+k,315);
 for(e=0;e<=260;e+=5)
  line(86+e,311,81+e,315);
put_text((int)x,(int)y+getmaxy()/3);
 /* cls */
 delay(20000);
 setcolor(0);
  line(400,300,bx,by);
  line(cx,300,bx,by);
  rectangle(cx-20,290,cx+20,310);
  circle(cx,300,2);
  circle(bx,by,2);
 }
while(!kbhit());
 getch();
 closegraph();
 return 0;
}

int put_text(x0,y0)
  int x0,y0;
{
  char *s1;
  s1=" 0148    2002-12-06";
  settextstyle(1,0,5);
  setcolor(BLUE);
  outtextxy(x0-6*8*3,y0,s1);
  outtextxy(x0-6*8*3+1,y0+1,s1);
  outtextxy(x0-6*8*3+2,y0+2,s1);
  outtextxy(x0-6*8*3+3,y0+3,s1);
}

关闭本页
 
首页 | 投资与合作 | 服务条款 | 隐私政策 | 收藏本站 | 设为首页 | 新用户注册 | 免责声明 | 使用帮助
Copyright ©2005-2008 chinaitpower.com All rights reserved. www.chinaitpower.com 版权所有