#include <stdio.h>
#include <process.h>
void soil_type(void);
int main()
{
soil_type();
return 0;
}
void soil_type()
{
char *type[]={"Clay","Silt","Sand","Gravel"};
double range[]={1.0e-10,1.0e-8,1.0e-4,1.0,100.0};
double perm;
int j,index;
printf("Please input the value of permeability=?\n");
scanf("%lf",&perm);
if(perm<range[0]||perm>range[4]){
printf("data out of ranfe the type is not defined\n");
printf("The range of permeability is between %lf and %lf\n",range[0],range[4]);
exit(1);
}
for(j=1; j<4;++j){
if((perm>=range[j-1])&&(perm<range[j])){
index=j-1;
break;
}
}
printf("The value of permeability is %lf\n",perm);
printf("The type of the soil is %s\n",type[index]);
}
--
※ 發信站: 批踢踢實業坊(ptt.twbbs.org)
◆ From: pc86.na.ntu.edu