C++上机作业答案.docxVIP

  • 35
  • 0
  • 约1.2万字
  • 约 37页
  • 2021-11-08 发布于江苏
  • 举报
第一章作业答案. 编写程序,将华氏温度转化为摄氏温度:公式:C=(5/9)*(F-32) 程序代码: #includeiostream using namespace std; void main() {float F,C; coutPlease input F:; cinF; C=5*(F-32)/9.0; coutC=Cendl; } 运行结果: 编写程序,输入圆柱体的半径 r 和高 h,计算圆柱体的体积。程序代码: #includeiostream using namespace std; #define PI 3.14159 void main() {float r,h,v; coutPlease input r h:; cinrh; v=PI*r*r*h; coutv=vendl; } 运行结果: 输入三角形的三条边 a,b,,c 利用海伦公式计算三角形的面积 area. 若 则 area= 程序代码: #includeiostream #includemath.h using namespace std; void main() {float a,b,c,p,area; coutPlease input a b c:; cinabc; if((a+bc)(b+ca)(a+cb)) {p=(a+b+c)/2.0; area=sqrt(p*(p-a)*(p-b)*(p-c)

文档评论(0)

1亿VIP精品文档

相关文档