01. /* 02. * Copyright (c) 2012, School of Computer Science, Yantai University 03. * All rights reserved. 04. * Author: Zhao guanzhe 05. * Completion Date: July 6, October 18, 2012. * version No.: v1.0 07.*08. * input Description: none. * Problem description: known radius and height 10. * program output: the area and perimeter of the circle, the surface area and volume of the ball, the surface area and volume of the cylindrical and conical 11. * Problem Analysis: omitted 12. * Algorithm Design: omitted 13. */# include <math. h >#include <iostream> using namespace std; # define PI 3.1415926int main () {int r, h, s, l, sq, vq, sz, vz, sy, vy; cout <"Enter the radius and height r, h:"; cin> r> h; s = r * PI; l = 2 * r * PI; sq = 4 * PI * r; vq = 3.0/4.0 * PI * r; sz = r * PI * h; vz = r * h; sy = PI * r + PI * r * sqrt (h * h + r * r ); vy = 3.0/1.0 * PI * r * h; cout <"Circle Area =" <s <endl; cout <"circle perimeter =" <l <endl; cout <"Ball Surface Area =" <sq <endl; cout <"ball volume =" <vq <endl; cout <"cylindrical surface area =" <sz <endl; cout <"cylindrical volume =" <vz <endl; cout <"cone surface area =" <sy <endl; cout <"cone volume =" <vy <endl; return 0 ;}
Running result:
Observation experience:
There are many errors and continuous debugging of this program. So I came to Shanxi laohe (I personally think he is the same as a friend, so I use this name) for help. The teacher analyzed several mistakes for me, which were really low-level mistakes. I checked carefully and finally corrected all the mistakes.
My summary:
With the deepening of the study, the current knowledge is almost impossible to complete the tasks assigned by Mr. He. The teacher may want us to preview in advance and master some additional knowledge points. Therefore, I personally think the task is very heavy. Through this blog, I understand that it is important to learn and use it.