C++程序编写编写一求圆柱体积的
#include
#include
#include
#define PI 3。1415926
using namespace std;
float BoxVolume(float length = 1。 0, float width = 1。0, float height = 1。0) {
return length * width *height;
}
inline float volume(float r = 1。 0, float h=1。0) {
return PI * r * r*h;
}
/*
*
*/
int main(int argc, char** argv) {
...全部
#include
#include
#include
#define PI 3。1415926
using namespace std;
float BoxVolume(float length = 1。
0, float width = 1。0, float height = 1。0) {
return length * width *height;
}
inline float volume(float r = 1。
0, float h=1。0) {
return PI * r * r*h;
}
/*
*
*/
int main(int argc, char** argv) {
std::cout << BoxVolume() << std::endl;
std::cout << BoxVolume(2。
0) << std::endl;
std::cout << BoxVolume(2。0, 2。0) << std::endl;
std::cout << BoxVolume(2。
0, 2。0, 2。0) << std::endl;
std::cout << volume() << std::endl;
std::cout << volume(2。0) << std::endl;
std::cout << volume(2。
0, 2。0) << std::endl;
return 0;
}。收起