📄 c01.cpp
字号:
// c01.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
int main(int argc, char* argv[])
{
// 圆柱体体积
double radius, height;
cout << "请输入圆柱体的半径和高:\n";
cin >> radius >> height;
double volume = radius * radius * height * M_PI;
cout << "该圆柱体的体积:" << volume << endl;
// 球面积
cout << "\n请输入球半径:\n";
cin >> radius;
double areaOfSphere = 4 * radius * radius * M_PI;
cout << "该球面的面积为:" << areaOfSphere << endl;
// 长方体体积
double length, width;
cout << "\n请输入长方体的长、宽、高:\n";
cin >> length >> width >> height;
volume = length * width * height;
cout << "该长方体的体积为:" << volume << endl;
return 0;
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -