#includestdio.h/*头文件*/#includemath.hfloatYd(floatm,intz);/*函数声明*/floatYda(floatm,intz);doubleYdf(floatm,intz);doubleZda(floatm,intz,doubleA);doubleZdf(floatm,intz,doubleA);doubleZR(floatm,intz,doubleA);doubleZB(doubleA,intz);doubleZC(doubleA,intz);doubleXd(floatm,intz,doubleC);doubleXda(floatm,intz,doubleC);doubleXdf(floatm,intz,doubleC);main(){/*变量定义*/doubleA,C;charop,p;intch1,ch2,ch3,ch4,z;floatm;FILE*fp1,*fp2,*fp3,*fp4,*fp5,*fp6,*fp7;printf(===========================================================================================\n);printf(===========================================================================================\n);printf(======================================欢迎使用齿轮计算软件=================================\n);printf(\n);printf(\n*********************************标准齿轮基本尺寸计算程序****************************\n);/*标题解释及提示信息*/printf(\n____________标准圆柱齿轮三种不同类型A,B,C_____________\n);printf(\nA.标准直齿轮\n);printf(\nB.标准直齿圆锥齿轮\n);printf(\nC:标准直齿斜齿轮\n);printf(\n);printf(\n);printf(\n);printf(\n);printf(\n-----请从标准模数表中选择你所需要的模数!------\n);/*从链接文件中选择你所需要的模数*/printf(\n);printf(\n);printf(\n);if((fp1=fopen(E:\\齿轮标准模数表.txt,r))==NULL){printf(\nCannotopenfile!);return1;}ch1=fgetc(fp1);while(ch1!=EOF){putchar(ch1);ch1=fgetc(fp1);}fclose(fp1);printf(\n);printf(是否继续计算?(yorn):);scanf(%c,&p);while(1){if(p=='y'){printf(\n***请选择要计算的齿轮类型(a或b或c):);scanf(%c,&op);/*标准直齿基本尺寸计算*/if(op=='a'){printf(\n***请输入模数:);scanf(%f,&m);printf(\n***请输入齿数:);/*格式输入信息*/scanf(%d,&z);if((fp2=fopen(E:\\标准直齿基本尺寸计算报告.txt,w))==NULL){printf(\nCannotopenfile!);}fprintf(fp2,***********************标准直齿轮基本尺寸***********************\n);fprintf(fp2,\n);fprintf(fp2,(模数:%3.1f,齿数%d),m,z);fprintf(fp2,\n);fprintf(fp2,_____________________________________________________\n);fprintf(fp2,|分度圆直径|d|%6.3f|\n,Yd(m,z));fprintf(fp2,|--------------|-------|-----------------------------|\n);fprintf(fp2,|齿顶圆直径|da|%6.3f|\n,Yd(m,z)+2*m);fprintf(fp2,|--------------|-------|-----------------------------|\n);fprintf(fp2,|齿根圆直径|df|%6.3lf|\n,Ydf(m,z));fprintf(fp2,|--------------|-------|-----------------------------|\n);fprintf(fp2,|齿顶高|ha|%6.3f|\n,m);fprintf(fp2,|--------------|-------|-----------------------------|\n);fprintf(fp2,|齿根高|hf|%6.3f|\n,1.25*m);fprintf(fp2,|--------------|-------|-----------------------------|\n);fprintf(fp2,|齿距|p|%6.3lf|\n,3.14*m);fprintf(fp2,|--------------|-------|-----------------------------|\n);fprintf(fp2,|齿高|h|%6.3f|\n,2.25*m);fprintf(fp2,|______________|_______|_____________________________|\n);fclose(fp2);if((fp3=fopen(E:\\标准直齿基本尺寸计算报告.txt,r))==NULL){printf(\nCannotopenfile!);return1;}ch2=fgetc(fp3);while(ch2!=EOF){putchar(ch2);ch2=fgetc(fp3);}fclose(fp3);}/*计算标准直齿锥齿轮*/elseif(op=='b'){printf(\n***请输入模数:);/*格式输入信息*/scanf(%f,&m);printf(\n***请输入齿数:);scanf(%d,&z);printf(\n***请输入分度圆锥角:);scanf(%lf,&A);if((fp4=fopen(E:\\标准直齿锥齿轮基本尺寸计算报告.txt,w))==NULL){printf(\nCannotopenfile!);}fprintf(fp4,\n***********************标准直齿锥齿轮基本尺寸***********************\n);fprintf(fp4,\n);fprintf(fp4,(模数:%3.1f,齿数%d,分度圆锥角%4.2lf),m,z,A);fprintf(fp4,\n);fprintf(fp4,\n_________________________________________________________________\n);fprintf(fp4,|分度圆直径|d|%6.3f|\n,Yd(m,z));fprintf(fp4,|------------------|-----------------|-------------------------|\n);fprintf(fp4,|齿顶圆直径|da|%6.3lf|\n,Zda(m,z,A));fprintf(fp4,|------------------|-----------------|-------------------------|\n);fprintf(fp4,|齿根圆直径|df|%6.3f|\n,Zdf(m,z,A));fprintf(fp4,|------------------|-----------------|-------------------------|\n);fprintf(fp4,|齿顶高|ha|%6.3lf|\n,m);\fprintf(fp4,|------------------|-----------------|-------------------------|\n);fprintf(fp4,|齿根高|hf|%6.3f|\n,1.2*m);fprintf(fp4,|------------------|-----------------|-------------------------|\n);fprintf(fp4,|齿高|h|%6.3f|\n,2.2*m);fprintf(fp4,|------------------|-----------------|-------------------------|\n);fprintf(fp4,|外锥距|R|%6.3lf|\n,ZR(m,z,A));fprintf(fp4,|------------------|-----------------|-------------------------|\n);fprintf(fp4,|齿顶角(度)|θa|%6.3lf|\n,ZB(A,z)*57.5);fprintf(fp4,|------------------|-----------------|-------------------------|\n);fprintf(fp4,|齿根角(度)|θf|%6.3lf|\n,ZC(A,z)*57.5);fprintf(fp4,|__________________|_________________|_________________________|\n);fclose(fp4);if((fp5=fopen(E:\\标准直齿锥齿轮基本尺寸计算报告.txt,r))==NULL){printf(\nCannotopenfile!);return1;}ch3=fgetc(fp5);while(ch3!=EOF){putchar(ch3);ch3=fgetc(fp5);}fclose(fp5);}/*标准斜齿轮基本尺寸计算*/elseif(op=='c'){printf(\n***请输入模数:);/*格式输入信息*/scanf(%f,&m);printf(\n***请输入齿数:);scanf(%d,&z);printf(\n***请输入螺旋角:);scanf(%lf,&C);if((fp6=fopen(E:\\标准斜齿轮基本尺寸计算报告.txt,w))==NULL){printf(\nCannotopenfile!);}fprintf(fp6,\n**********************标准斜齿轮基本尺寸**********************\n);fprintf(fp6,\n);fprintf(fp6,(模数:%3.1f,齿数%d,螺旋角%4.2lf),m,z,C);fprintf(fp6,\n);fprintf(fp6,______________________________________________________\n);fprintf(fp6,|分度圆直径|d|%6.3lf|\n,Xd(m,z,C));fprintf(fp6,|--------------------|-----------|--------------------|\n);fprintf(fp6,|齿顶圆直径|da|%6.3lf|\n,Xda(m,z,C));fprintf(fp6,|----------------