关于C++养鱼所需要池塘表面积的问题,,,(对高手来说简单吧)

构建一池塘喂养一些鱼,必须保证该池塘表面积为2平方英尺,才能确保每条鱼有6英尺长,本例需要确定池塘的直径,来确保鱼有足够空间 前面一些头文件省了(我是刚开始学C++的,只有一点点C语言的基础) 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.14159263; double fish_count=0.0; double fish_length=0.0; cout<<"Enter the number of fish you want to keep:"; cin>>fish_count; cout<<"Enter the average fish length in inches:"; cin>>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*aqrt(pond_area/pi); cout<<----------------------------以下省略} 我想问,main函数里的第一句是什么意思,2.0/0.5是怎么出来的?虽然旁边有注释,,但是我连注释也看不懂..英语不行....其他语句能理解 请高手指点下我这个菜鸟....
2026年09月26日 13:53
有2个网友回答
网友(1):

每条单位长度的鱼的面积

网友(2):

单位长度的鱼所需的面积