C语言 齿轮基本参数的计算程序

合集下载
  1. 1、下载文档前请自行甄别文档内容的完整性,平台不提供额外的编辑、内容补充、找答案等附加服务。
  2. 2、"仅部分预览"的文档,不可在线预览部分如存在完整性等问题,可反馈申请退款(可完整预览的文档不适用该条件!)。
  3. 3、如文档侵犯您的权益,请联系客服反馈,我们会尽快为您处理(人工客服工作时间:9:00-18:30)。

printf("\n
____________ 标 准 圆 柱 齿 轮 三 种 不 同 类 型
A,B,C_____________\n");
printf("\n
A.标准直齿轮\n");
printf("\n
B.标准直齿圆锥齿轮\n");
printf("\n
C:标准直齿斜齿轮\n");
printf("\n");
fprintf(fp4," |
齿顶角(度) |
θa
|
%6.3lf
|\n",ZB(A,z)*57.5);
fprintf(fp4," |------------------|-----------------|-------------------------|\n");
fprintf(fp4," |
齿根角(度) |
printf("\n***请输入齿数:"); /*格式输入信息*/ scanf("%d",&z);
if((fp2=fopen("E:\\标准直齿基本尺寸计算报告.txt","w"))==NULL) {printf("\n Cannot open file!"); }
fprintf(fp2,"*********************** 标 准 直 齿 轮 基 本 尺 寸
fprintf(fp4," |
齿顶圆直径
|
da
|
%6.3lf
|\n",Zda(m,z,A));
fprintf(fp4," |------------------|-----------------|-------------------------|\n");
fprintf(fp4," |
齿根圆直径
|p|
%6.3lf
|--------------|-------|-----------------------------|\n");
|
齿高
|h|
%6.3f
|______________|_______|_____________________________|\n");
if((fp3=fopen("E:\\标准直齿基本尺寸计算报告.txt","r"))==NULL) {printf("\n Cannot open file!");
============\n");
printf("
===============================================================================
============\n");
printf(" ====================================== 欢 迎 使 用 齿 轮 计 算 软 件
=================================\n");
printf("\n");
printf("\n ********************************* 标 准 齿 轮 基 本 尺 寸 计 算 程 序
****************************\n"); /*标题解释及提示信息*/
printf("\n");
printf("\n");
printf("\n");
printf("\n
-----请从标准模数表中选择你所需要的模数!------\n");/*从链接文
件中选择你所需要的模数*/ printf("\n"); printf("\n"); printf("\n");
if((fp1=fopen("E:\\齿轮标准模数表.txt","r"))==NULL) {printf("\n Cannot open file!"); return 1; } ch1=fgetc(fp1); while(ch1!=EOF) { putchar(ch1); ch1=fgetc(fp1); } fclose(fp1); printf("\n");
%6.3f
|--------------|-------|-----------------------------|\n");
|
齿根高
| hf |
|\n",m); %6.3f
|--------------|-------|-----------------------------|\n");
|
齿距
fprintf(fp4," |
齿根高
|hf|%6.f|\n",1.2*m);
fprintf(fp4," |------------------|-----------------|-------------------------|\n");
fprintf(fp4," |
齿高
|
h
|
%6.3f
|\n",2.2*m);
%6.3f
|--------------|-------|-----------------------------|\n");
| 齿根圆直径 | df |
%6.3lf
|\n",
|--------------|-------|-----------------------------|\n");
| 齿顶高 | ha |
printf("\n***请输入齿数:");
scanf("%d",&z);
printf("\n***请输入分度圆锥角:"); scanf("%lf",&A);
if((fp4=fopen("E:\\标准直齿锥齿轮基本尺寸计算报告.txt","w"))==NULL)
{printf("\n Cannot open file!"); }
ch3=fgetc(fp5); } fclose(fp5); }
/*标准斜齿轮基本尺寸计算*/ else if(op=='c') {
printf("\n***请输入模数:");/*格式输入信息*/ scanf("%f",&m);
printf("\n***请输入齿数:"); scanf("%d",&z);
_____________________________________________________\n");
| 分度圆直径 | d |
%6.3f
|--------------|-------|-----------------------------|\n"); | 齿 顶 圆 直 径 | da |
fprintf(fp4,"\n");
fprintf(fp4,"\n
_________________________________________________________________\n");
fprintf(fp4," |
分度圆直径
|
d
|
%6.3f
|\n",Yd(m,z));
fprintf(fp4," |------------------|-----------------|-------------------------|\n");
|
df
|
%6.3f
|\n",Zdf(m,z,A));
fprintf(fp4," |------------------|-----------------|-------------------------|\n");
fprintf(fp4," |
齿顶高
|
ha
|
%6.3lf
|\n",m);\
fprintf(fp4," |------------------|-----------------|-------------------------|\n");
θf
|
%6.3lf
|\n",ZC(A,z)*57.5);
fprintf(fp4,"
|__________________|_________________|_________________________|\n");
fclose(fp4);
if((fp5=fopen("E:\\标准直齿锥齿轮基本尺寸计算报告.txt","r"))==NULL) {printf("\nCannot open file!"); return 1; } ch3=fgetc(fp5); while(ch3!=EOF) { putchar(ch3);
return 1; }
ch2=fgetc(fp3); while(ch2!=EOF) { putchar(ch2); ch2=fgetc(fp3); } fclose(fp3); }
/*计算标准直齿锥齿轮*/ else if(op=='b') {
printf("\n***请输入模数:");/*格式输入信息*/ scanf("%f",&m);
fprintf(fp4,"\n*********************** 标 准 直 齿 锥 齿 轮 基 本 尺 寸
***********************\n");
fprintf(fp4,"\n");
fprintf(fp4,"
( 模 数 :%3.1f , 齿 数 %d, 分 度 圆 锥
角%4.2lf)",m,z,A);
***********************\n");
fprintf(fp2,"\n");
fprintf(fp2,"
(模数:%3.1f ,齿数%d)",m,z);
fprintf(fp2,"\n");
fprintf(fp2," fprintf(fp2," |\n",Yd(m,z)); fprintf(fp2," fprintf(fp2," |\n",Yd(m,z)+2*m); fprintf(fp2," fprintf(fp2," Ydf(m,z)); fprintf(fp2," fprintf(fp2," fprintf(fp2," fprintf(fp2," |\n",1.25*m); fprintf(fp2," fprintf(fp2," |\n",3.14*m); fprintf(fp2," fprintf(fp2," |\n",2.25*m); fprintf(fp2," fclose(fp2);
#include<stdio.h> #include<math.h> float Yd(float m,int z); float Yda(float m,int z); double Ydf(float m,int z); double Zda(float m,int z,double A); double Zdf(float m,int z,double A); double ZR(float m,int z,double A); double ZB(double A,int z); double ZC(double A,int z); double Xd(float m,int z,double C); double Xda(float m,int z,double C); double Xdf(float m,int z,double C);
/*头文件*/ /*函数声明*/
main() {
/*变量定义*/ double A,C; char op,p; int ch1,ch2,ch3,ch4,z; float m; FILE *fp1,*fp2,*fp3,*fp4,*fp5,*fp6,*fp7;
printf("
===============================================================================
fprintf(fp4," |------------------|-----------------|-------------------------|\n");
fprintf(fp4," |
外锥距
|
R
|
%6.3lf
|\n",ZR(m,z,A));
fprintf(fp4," |------------------|-----------------|-------------------------|\n");
printf("是否继续计算?(y or n):"); 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("%lf",&C);
if((fp6=fopen("E:\\标准斜齿轮基本尺寸计算报告.txt","w"))==NULL) {printf("\n Cannot open file!"); }
相关文档
最新文档