资源描述:
《2011南开二级c语言上机100题---带解析》由会员上传分享,免费在线阅读,更多相关内容在教育资源-天天文库。
1、第一套给定程序的功能是:求二分之一的圆面积,函数通过形参得到圆的半径,函数返回二分之一的圆面积(注:圆面积公式为:2,在程序中定义的变量名要与公式的变量相同)。例如,输入圆的半径值:19.527,输出为:s=598.949991。注意:部分源程序给出如下。请勿改动main函数和其他函数中的任何内容,仅在横线上填入所编写的若干表达式或语句。试题程序:#includedoublefun(doubler){return3.14159*【1】/2.0;}voidmain(){doublex;printf("Enterx:");scanf("%lf",【2
2、】);printf("s=%lf",fun(【3】));}【参考答案】(1)r*r(2)&x(3)x【考点分析】本题考查:圆面积计算公式*r*r;scanf()函数的形式,其一般形式为"scanf("格式控制字符串",地址表列);",注意地址是由地址运算符"&"后跟变量名组成的;printf()函数的形式,其一般形式为"printf("格式控制字符串",输出表列);";函数实参调用,函数作为另一个函数调用的实际参数出现。【解题思路】填空1:计算圆的面积,公式为:*r。填空2:scanf()函数一般形式为scanf(格式控制,地址表列),因此填入&x。填空3:函
3、数的实际参数是圆的半径x。下列给定程序中,函数fun的功能是:计算S=f(-n)+f(-n+1)+…+f(0)+f(1)+f(2)+…f(n)的值。例如,当n为5时,函数值应为10.407143。f(x)函数定义如下:f(x)=请改正程序中的错误,使它能得出正确的结果。air,keephouseairfresh,cooling,moisture,reducethebodytemperatureofthechicken,whichisameasureofthechickenhousethefirstelementoftheenvironment.(1)thepara
4、meters:ventilationinsummerpeakdemandcalculations,4~5cubicmetresperkilogramofbodyweightperhour,harmfulgasconcentrationdoesnotexceed20ppmammonia,hydrogensulfide,l0ppm,co0.15%.(2)ventilationnaturalventilationandmechanical...5.thermalinsulationroofcoldseasonistheregionofgreatestheatloss,a
5、realsohottowelsunlightthananyotherregion,sotheroofinsulationisthemostimportantregion,followedbythewalls,ifopenshedstomakedoorsandWindowsswitchesfreely,andsealwell.Onmostofthewallsandroofinsulationmustbetakenorequivalentdevices,thermalinsulationmaterialsrequirehigherthermalresistance,g
6、oodthermalinsulationproperties,andthickentheNorthwallmustalsobetakenofthicknessandmeasuressuchasroofandceilingcanopy.Inplaceswithmorerain,duetheeavesofroofsonbothsidesextendingoutward.Pheasants(pheasants)farmbuilding(a)sitechoosepheasantfieldsshouldbeselectedgaozaoterrain,sandtexture,
7、welldrained,slightlytotheSouthofterrain.Mountainareasshouldbeselectedunderthesunny,spacious,ventilation,sunshine,wherethedrainageisgood.Pheasantfarmsshouldbebuiltinaquiet,safeplace,awayfromresidentialareas,factories,themaintrafficartery,buttakingintoaccountfeed,transportationproblems.
8、Aclea