.
CAD/CAM技术》实验报告
实验名称:数表的程序化办理
.
.
四、实验过程
1、程序结构图
开始
输入轴径d
显示越界,输出轴径范围信息
d<=17||d>130?
N
Y
比较确立d所在区间
输出相应尺寸
N
重新计算
可否减小一挡?
Y
尺寸可否已最小?
Y
显示最小提示信息
结束
2、源代码
#include<>
#include<>
#include<>
#include<>
main( )
{
inti=0,ch,
dc[12]={22,30,38,44,50,58,65,75,85,95,110,130},
b[12]={6,8,10,12,14,16,18,20,22,25,28,32},
h[12]={6,7,8,8,9,10,11,12,14,14,16,18};
floatd,ds,dw,
t[12]={,4,5,5,,6,7,,9,9,10,11},
N
t1[12]={,,,,,,,,,,,};
puts("\n\td(mm)是轴的直径.");
printf("\n\t请输入直径:d=");
scanf("%f",&d);
while(d<=17||d>130)
{
.
.
puts("\n\t这个直径已超出范围!\n");
printf("\n\t请重新输入直径(d在17~130mm):d=");
scanf("%f",&d);/*此处用goto更简洁*/
}
while(d>dc[i])i++;
printf("\n\td=%.1fmm,b=%imm,h=%imm,t=%.1fmm,t1=%.1fmm,",d,b[i],h[i],t[i],t1[i]);
ds=d-t[i];
dw=d+t1[i];
printf("\n\td+t1=%.1fmm,\td-t=%.1fmm",dw,ds);
printf("\n\n\t你可否减小一档键的b/h?(y/n):");
ch=getch( );
putch(ch);
if(ch=='y')
{
if(d<=22)
{
puts("\n\n\t已到最低当档!没法再减");
exit(1);
}
}
else
{
printf("\n\t");
return;
}
i--;
printf("\n\td=%.
《数表的程序化处理》实验报告 来自淘豆网m.daumloan.com转载请标明出处.