fish_length = fish_length/inches_per_foot; 用鱼的平均长度除以12是什么意思啊?是转换成什么呀?

问题描述:

fish_length = fish_length/inches_per_foot; 用鱼的平均长度除以12是什么意思啊?是转换成什么呀?
// Program 2.6 Sizing a pond for happy fish
#include
#include // For square root calculation
using std::cout;
using std::cin;
using std::sqrt;
int main() {
const double fish_factor = 2.0/0.5; // Area per unit length of fish
const double inches_per_foot = 12.0;
const double pi = 3.14159265;
double fish_count = 0.0; // Number of fish
double fish_length = 0.0; // Average length of fish
cout > fish_count;
cout > fish_length;
fish_length = fish_length/inches_per_foot; // Convert to feet
// Calculate the required surface area
double pond_area = fish_count * fish_length * fish_factor;
// Calculate the pond diameter from the area
double pond_diameter = 2.0 * sqrt(pond_area/pi);
cout

那是转换成英呎.
该电脑程式的前一个指令是要求使用者以英吋输入鱼的平均长度,而一英呎等於12英吋,所以要把使用者输入的答案转换成英呎,再用接下来的程序计算出最佳的鱼池面积(以平方英呎表示),最后再把这个面积换算成鱼池直径,作为输出给使用者的答案.