███这个程序用TC3.0调试怎么老是Unable to open include file‘03-01.H
主程序:程序代码:
#include<math.h> #include<stdio.h> #include"03-01.h" #include<graphics.h> #define PI 3.1415926 float s[360],v[360],a[360],arfa1,arfa2,R,R1; static float x[360],y[360],x1[360],y1[360]; float r0,h,A1,A2,e,s0,rt,w,M,s2,s4,L; int s1,s3,i,N,dr=1;/*dr=1表示滚子移动从动件盘形凸轮*/ void xy(),arfaf(),pf(),input(),cit(); main() {clrscr(); input();/*输入已知数据*/ select();/*选择运动规律并计算运动参数:s[i],v[i],a[i]*/ swil();/*计算远休止、近休止参数函数*/ xy();/*计算轮廓各点坐标:x[i],y[i],x1[i],y1[i]*/ printf();/*打印函数*/ arfaf();/*判断压力角*/ if(N!=1) {pf();/*判断光滑点运动失真函数*/ if(N!=1) cit();/*函数不同运动规律交汇点处失真函数*/ if (N!=1) {getch(); clrscr(); getch(); printf("黄色曲线为位移曲线,绿色曲线为速度曲线,红色曲线为加速度曲线"); printf("黄色轮廓为实际轮廓,红色轮廓为理论轮廓,白色圆为基圆"); draw();getch(); } } } void input() /*输入已知数据函数*/ {list(); /*列举运动规律函数*/ printf("输入基圆半径r0:");scanf("%f",&r0); printf("输入行程h:");scanf("%f",&h); printf("输入推程角A1:");scanf("%f",&A1); printf("选择运动规律s1:");scanf("%f",&s1); printf("输入远休止角A2:");scanf("%f",&A2); printf("输入回程角A3:");scanf("%f",&A3); printf("选择运动规律s3:");scanf("%f",&s3); printf("输入偏心距e:");scanf("%f",&e); printf("输入凸轮角速度w:");scanf("%f",&w); printf("输入滚子半径rt:");scanf("%f",&rt); printf("输入内外包络线代号M内包络(-1),外包络(+1):");scanf("%f",&M); printf("输入推程许用压力角arfa1:");scanf("%f",&arfa1); printf("输入回程许用压力角arfa2:");scanf("%f",&arfa2); printf("输入运动失真精度L:");scanf("%f",&L); } void xy() /*计算轮廓各点坐标:x[i],y[i],x1[i],y1[i]函数*/ {float dxdfi,dydfi,FM; s0=sqrt(r0*r0-e*e); for (i=0;i<=359;i++) {dxdfi=(v[i]/w-e)*cos(i*PI/180)-(s0+s[i])*sin(i*PI/180); dydfi=(v[i]/w-e)*sin(i*PI/180)+(s0+s[i])*cos(i+PI/180); if(rt==0) {x[i]=(s0+s[i])*cos(i*PI/180)-e*sin(i*PI/180); y[i]=(s0+s[i])*sin(i*PI/180)+e*cos(i*PI/180); else{x[i]=(s0+s[i])*cos(i*PI/180)-e*sin(i*PI/180); y[i]=(s0+s[i])*sin(i*PI/180)+e*cos(i*PI/180); FM=sqrt(dxdfi*dxdfi+dydfi*dydfi); x1[i]=x[i]+M*rt*dydfi/FM; y1[i]=y[i]-M*rt*dxdfi/FM; } } } void arfaf() /*判断压力角函数*/ {float rs0,arfa; int i; s0=sqrt(r0*r0-e*e); for(i=0;i<=(A1+A2+A3);i++) {rs0=s0+s[i]; if(i<A1) {arfa=fabs(atan((v[i]/w-e)/rs0)); if(arfa>(arfa1*PI/180)) {N=1; printf("推程压力角大于许用压力角,请重新选择参数"); printf("\n,arfa=%f,arfa1=%f",arfa,arfa1*PI/180); getch(); break;} } else if(i>=(A1+A2)&&i<=(A1+A2+A3)) {arfa=fabs(atan((v[i]/w-e)/rs0)); if(arfa>(arfa2*PI/180)) {N=1; printf("回程压力角大于许用压力角,请重新选择参数"); getch();break;} } } } void pf() /*判断运动失真函数*/ {float xx,yy,p,P; /*p为中间导出量*/ int i; s0=sqrt(r0*r0-e*e); for(i=0;i<=359;i++) {xx=(s0+s[i])*(s0+s[i])+(v[i]/w-e)*(v[i]/w-e); /*xx,yy为中间导出量*/ p=sqrt(xx*xx*xx); yy=(v[i]/w-e)*(2*v[i]/w-e)-(s0+s[i])*(a[i]/(w*w)-s0-s[i]); P=p/yy; if(fabs(P+M*rt)<=3) {N=1; printf("在%d度处运动失真\n",i); getch();break; } } } void cit() /*判断两种运动规律交汇点处运动失真函数*/ {float LAB,LCD,LAD,dxdfi1,dydfi1,dxdfi2,dydfi2,xi1,yi1,xi2,yi2,x12,y12,x22,y22,FM; s0=sqrt(r0*r0-e*e); dxdfi=(0/w-e)*cos(A1*PI/180)-(s0+s[A1])*sin(A1*PI/180); dydfi=(0/w-e)*sin(A1*PI/180)-(s0+s[A1])*cos(A1*PI/180); xi1=(s0+s[A1])*cos(A1*PI/180)-e*sin(A1*PI/180); yi1=(s0+s[A1])*sin(A1*PI/180)-e*cos(A1*PI/180); FM=sqrt(dxdfi1*dxdfi1+dydfi1*dydfi1); x12=xi1+M*rt*dydfi1/FM; y12=yi1-M*rt*dxdfi1/FM; dxdfi2=(0/w-e)*cos((A1+A2)*PI/180)-(s0+s[A1+A2])*sin((A1+A2)*PI/180); dydfi2=(0/w-e)*sin((A1+A2)*PI/180)+(s0+s[A1+A2])*cos((A1+A2)*PI/180); xi2=(s0+s[A1+A2])*cos((A1+A2)*PI/180)-e*sin((A1+A2)*PI/180); yi2=(s0+s[A1+A2])*sin((A1+A2)*PI/180)+e*cos((A1+A2)*PI/180); FM=sqrt(dxdfi2*dxdfi2+dydfi2*dydfi2); x22=xi2+M*rt*dydfi2/FM; y22=yi2-M*rt*dxdfi2/FM; if(A2!=0) {LAB=(x12-x1[A1])*(x12-x1[A1]+(y12-y1[A1])*(y12-y1[A1]); LCD=(x22-x1[A1+A2])*(x22-x1[A1+A2]+(y22-y1[A1+A2])*(y22-y1[A1+A2]); if(LAB>L) /*L为运动失真精度*/ {N=1; printf("在推程结束处运动失真"); getch(); } if (LCD>L) {N=1; printf("在回程开始处运动失真"); getch();} } else if(A2==0) {LCD=(x22-x1[A1+A2])*(x22-x1[A1+A2])-(y22-y1[A1+A2])*(y22-y1[A1+A2]); if(LAD>L) {N=1; printf("在推程结束处运动失真"); getch();} } }
================================
03-01.h
程序代码:
/*文件名:03-01.h*/ #include "math.h" #include "stdio.h" #include "graphics.h" #define PI 3.1415926 #define X 150 #define Y 80 float A1,A2,A3,r0,h,rt,lp,w,vmax,la,s2,s4,R,R1; float x[360],y[360],x1[360],y1[360],s[360],v[360],a[360]; int dr,s1,s3;; void list() {printf("\n\t 常用从动件运动规律:\n"); printf("\t1:等速运动\t2:等加速等减速运动\t3:简谐运动\t4:摆线运动\n");} void select() {switch(s1) {case 1:calculate_1A();break; case 2:calculate_2A();break; case 3:calculate_3A();break; case 4:calculate_4A();break;} switch(s3) {case 1:calculate_1B();break; case 2:calculate_2B();break; case 3:calculate_3B();break; case 4:calculate_4B();break;} } calculate_1A() {int i; for(i=0;i<=A1;i++) {s[i]=h*i/A1; v[i]=h*w/(A1*PI/180); a[i]=0;} } calculate_1B() {int i; for(i=(A1+A2);i<=(A1+A2+A3);i++) {s[i]=h*(1-(i-(A1+A2))/A3); v[i]=-h*w/(A3*PI/180); a[i]=0;} } calculate_2A() {int i; for(i=0;i<=A1/2;i++) {s[i]=2*h*i*i/(A1*A1); v[i]=4*h*w*i/(A1*A1*PI/180); a[i]=4*h*w*w/(A1*PI*A1*PI/(180*180));} for(i=A1/2;i<=A1;i++) {s[i]=h-2*h*(A1-i)*(A1-i)/(A1*A1); v[i]=4*h*w*(A1-i)/((A1*A1)*PI/180); a[i]=-4*h*w*w/(A1*PI*A1*PI/(180*180));} } calculate_2B() {int i; for(i=(A1+A2);i<=(A1+A2+A3/2);i++) { s[i]=h-2*h*(i-(A1+A2))*(i-(A1+A2))/(A3*A3); v[i]=-4*h*W*(i-(A1+A2))/(A3*A3*PI/180); a[i]=-4*h*w*w/(A3*PI*A3*PI/(180*180));} for(i=(A1+A2+A3/2);i<(A1+A2+A3);i++) { s[i]=2*h*(A1+A2+A3-i)*(A1+A2+A3-i)/(A3*A3); v[i]=-4*h*w*(A1+A2+A3-i)/(A3*A3*PI/180); a[i]=4*h*w*w/(A3*PI*A3*PI/(180*180));} } calculate_3A() {int i; float angle; for(i=0;i<=A1;i++) {angle=PI*i/A1; s[i]=h*(1-cos(angle))/2; v[i]=PI*h*w*sin(PI*i/A1)/(2*A1*PI/180); a[i]=PI*PI*h*w*w*cos(PI*i/A1);} } calculate_3B() { int i; float angle; for(i=(A1+A2);i<(A1+A2+A3);i++) { angle=PI*(i-(A1+A2))/A3; s[i]=h*(1+cos(angle))/2; v{i]=-PI*h*w*sin(PI*(i-(A1+A2))/A3); a[i]=-PI*PI*h*w*w*cos(PI*(i-(A1+A2))/A3)/(2*A3*PI*A3*PI/(180*180)); } } calculate_4A(A1,h,w) float h,A1,w; { int i; for(i=0;i<=A1;i++) {s{i]=h*(i/A1-sin(2*PI*i/A1)/(2*PI)); v[i]=h*w*(1-cos(2*PI*i/A1))/(A1*PI/180); a[i]=2*PI*h*w*w*sin(2*PI*i/A1)/(A1*PI*A1*PI/(180*180));} } calculate_4B(A1,A2,A3,h,w) float h,A1,A2,A3,w; { int i; float angle; for(i=(A1+A2);i<=(A1+A2+A3);i++) {angle=2*PI*(i-(A1+A2))/A3; s[i]=h*(1-(i-(A1+A2))/A3+sin(angle)/(2*PI)); v[i]=-h*w*(1-cos(2*PI*(i-(A1+A2))/A3))/(A3*PI/180); a[i]=-2*PI*h*w*w*sin(2*PI*(i-(A1+A2))/A3)/(A3*PI*A3*PI/(180*180)); } } void swil() { int i; for(i=A1+1;i<A1+A2;i++) { s[i]=h;v[i]=0;a[i]=0;} for(i=A1+A2+A3;i<359;i++) {s[i]=0;v[i]=0;a[i]=0;} } void draw() { int i; int gd=DETECT,gm; initgraph(&gd,&gm,""); setcolor(14); setlinestyle(0,1,1); line(X-120,Y,X+120,Y);line(X,Y-120,X,Y+120); setlinestyle(0,1,1); setcolor(15); circle(X,Y,r0); setcolor(15); line(X+r0+100,Y,X+r0+100,Y+400); line(X+r0+100,Y,X+r0+400,Y); line(X,Y,x[0]+X,y[0]+Y); setcolor(2); line(X,Y,x[A1]+x,y[A1]+Y); line(X,Y,x[A1+A2]+X,y[A1+A2]+Y); line(X,Y,x[A1+A2+A3]+X,y[A1+A2+A3]+Y); if(dr==1) { line(x[0]+X,y[0]+Y,x[0]+X+70,y[0]+Y); circle(x[0]+X,y[0]+Y,rt); } else if (dr==2) { line(x[0]+X,y[0]+Y,X+la,Y); circle(x[0]+X,y[0]+Y,rt);} else{ line(x1[0]+X,e+Y,x1[0]+X+70,e+Y); lp=2*vmax/w+5; line(x[0]+X,y[0]+Y-lp/2,x[0]+X+70,y[0]+Y+lp/2);} for(i=0;i<359;i++) { setcolor(4); if(dr!=3) {line(x[i]+X,y[i]+Y,x[i+1]+X,y[i+1]+Y); setcolor(14); line(x1[i]+X,y1[i]+Y,x1[i+1]+X,y1[i+1]+Y);} else{setcolor(14); line(x1[i]+X,y1[i]+Y,x1[i+1]+X,y1[i+1]+Y);} } } setcolor(14); for(i=0;i<=359;i++) line(X+r0+100+s[i],i+Y,X+r0+100+s[i+1],i+1+Y); setcolor(2); for(i=0;i<=359;i++) line(X+r0+100+v[i]/100,i+Y,X+r0+100+v[i+1]/100,i+1+Y); setcolor(4); for(i=0;i<=359;i++) line(X+r0+100+a[i]/10000,i+Y,X+r0+100+a[i+1]/10000,i+1+Y);} void print() {int i; for(i=0;i<=359;i++) { printf("s[%d]=%f,v[%d]=%f,a[%d]%f\n",i,s[i],i,v[i],i,a[i]); printf("x[%d]=%f,y[%d]=%f,x1[%d]=%f,y1[%d]=%f\n",i,x[i],i,y[i],i,x1[i],i,y1[i]);}}
============================================================
还有,用安了easyx的vc6.0也编译不了。
graphics.h出了好多错
希望各位大大帮忙看看~~
[ 本帖最后由 listee 于 2011-5-11 15:39 编辑 ]