?? c01a.cpp
字號:
// c01a.cpp : Defines the entry point for the console application.
//
#include "stdafx.h"
#include <iostream.h>
#include <math.h>
#ifndef M_PI
#define M_PI 3.14159265358979323846
#endif
double Cylinder( double r, double h );
double Sphere( double r );
double Rectangle( double l, double w, double h );
int main(int argc, char* argv[])
{
double radius, height;
cout << "請輸入圓柱體的半徑和高:\n";
cin >> radius >> height;
double volume = Cylinder( radius, height );
cout << "該圓柱體的體積為:" << volume << endl;
cout << "請輸入球半徑:\n";
cin >> radius;
double areaOfSphere = Sphere( radius );
cout << "該球面的面積為:" << areaOfSphere << endl;
double length, width;
cout << "請輸入長方體的長、寬、高:\n";
cin >> length >> width >> height;
volume = Rectangle( length, width, height );
cout << "該長方體的體積為:" << volume << endl;
return 0;
}
double Cylinder( double r, double h )
{
return r * r * M_PI * h;
}
double Sphere( double r )
{
return 4 * r * r * M_PI;
}
double Rectangle( double l, double w, double h )
{
return l * w * h;
}
?? 快捷鍵說明
復(fù)制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -