我在做什么错(基本C ++)?

时间:2019-05-27 06:32:17

标签: c++

C ++的新手,不知道此错误是什么意思(C4700)。我正在创建一个非常基本的程序,可以计算各种形状的体积,面积,表面积等。任何有关如何修复代码的输入或解释,请多谢:)。

using namespace std;

int main()
{
double cylHeight;
double cylRadius;
double triPrismHeight;
double triPrismBase;
double triPrismWi;
double triPrismDepth;
double sqPyramidHeight;
double sqPyrmaidLength;
double saCylinder;
double vCylinder;
double saTriPrism;
double vTriPrism;
double saSqPyramid;
double vSqPyramid;
const double PI = 3.14159;
cout << fixed << setprecision(2);

cout << "Enter the Height of the cylinder: " << endl;
cin >> cylHeight;
cout << "Enter the radius of the cylinder: " << endl;
cin >> cylRadius;
cout << "Enter the Height of the Triangular Prism: " << endl;
cin >> triPrismHeight;
cout << "Enter the Base of the Triangular Prism: " << endl;
cin >> triPrismBase;
cout << "Enter the Depth of the Triangular Prism: " << endl;
cin >> triPrismDepth;
cout << "Enter the height of the square pyramid: " << endl;
cin >> sqPyramidHeight;
cout << "Enter the length of the square pyramid: " << endl;
cin >> sqPyrmaidLength;

saCylinder = (2 * PI * cylHeight * cylRadius) + (2 * PI * cylRadius * cylRadius);
cout << "The surface area of the cylinder: " << saCylinder << endl;
vCylinder = (PI * cylRadius * cylRadius * cylHeight);
cout << "The volume of the cylinder: " << vCylinder << endl;
saTriPrism = (triPrismBase * triPrismHeight + (2 * triPrismDepth * triPrismWi) + (triPrismDepth * triPrismBase));
cout << "The surface area of the triangular prism: " << saTriPrism << endl;
vTriPrism = (triPrismBase * triPrismHeight);
cout << "The volume of the triangular prism: " << vTriPrism << endl;
saSqPyramid = (sqPyrmaidLength * sqPyrmaidLength + (2 * sqPyrmaidLength) * (sqrt((sqPyrmaidLength * sqPyrmaidLength) / 4) + sqPyramidHeight * sqPyramidHeight));
cout << "The surface area of a square pyramid: " << saSqPyramid << endl;
vSqPyramid = (sqPyrmaidLength * sqPyrmaidLength) * (sqPyramidHeight / 3);
cout << "The volume of a square pyramid: " << vSqPyramid << endl;

system("pause");
return 0;
}

错误消息-C4700(使用第48行未初始化的局部变量'triPrismWi')。

0 个答案:

没有答案
相关问题