#include “stdio.h”
#include “conio.h”
#include “math.h”
main()
{
int i,j,k,m,n=0,number=43,bmin,bmax;
int agear1=number,agear2=number+1;
float d_ratio,a_error;
float agear,bgear,agear3,agear4;
static int gear[43]={20,20,23,24,25,30,33,34,35,37,40,41,43,45,47,48,50,53,
55,57,58,59,60,61,62,65,67,70,71,73,75,79,80,83,89,90,92,95,97,98,100};
printf(“Please input the drive ratio:”);scanf(“%f”,&d_ratio);
printf(“Please input allowable error:”);scanf(“%f”,&a_error);
if(d_ratio<1){bmin=gear[0]*gear[1]/d_ratio;
bmax=gear[number-2]*gear[number-1];}
else {bmin=gear[0]*gear[1];bmax=gear[number-2]*gear[number-1]/d_ratio;}
for(i=0;i<number-2;i++){
if(gear[i]*gear[i+1]>bmax)break;
if(gear[i]*gear[number-1]<bmin)continue;
for(j=i+1;j<number-1;j++){bgear=gear[i]*gear[j];
if(bgear>bmax)break;
if(bgear<bmin)continue;
agear3=(int)(d_ratio*bgear+0.5);
agear4=agear3/bgear-d_ratio;
if(fabs(agear4)>a_error)continue;
for(k=0;k<=number-1;k++){agear =agear3/gear[k];
if(agear>100::agear!=int(agear))continue; 错误 If 语句缺少 ‘)’在 main 函数中
for(m=k+1;m<=number-1;m++){
if(agear1=gear[m])continue; 警告 可能是不正确的赋值在 main 函数中
if(agear1==i::agear1==j::agear2==i::agear2==j)continue; 错误 If 语句缺少 ‘)’在 main 函数中
if(gear[m]+gear[i]<=gear[k]::gear[k]+gear[j]<=geat[i])continue; 错误 If 语句缺少 ‘)’在 main 函数中
n++;agear3=agear3/bgear;agear4=agear3-d_ratio;
if(n%6==0){printf(“\007″);getch();}
if(n==1)printf(“\nNo. Z1 Z2 Z3 Z4 i e\n”);
printf(“%2d%7d%7d%7d%7d”,n,gear[m],gear[i],gear[k],gear[j]);
printf(“%13.7f%12.7f\n”,agear3,agear4);
agear1=m;agear2=k;break;
}
}
}
}
if(n==0){printf(“No gears because allowable error %f is too little,\n”,a_error);
printf(“Please change it and try again!\007\n”);}
else printf(“OK\007\n”);
puts(“Hello, world\n”);
getch();
return(0);
}警告 cdgljs.c 50: ‘agear2′ 被赋值但却没有使用在 main 函数中
求高手帮助解决啊!为什么会缺 ) 呢???
>> 本文固定链接: http://www.vcgood.com/archives/2876