1
こんにちは私は基本的なc++プログラムを修正するための助けが必要です。 SurfaceArea
と私のLateralArea
にエラーが発生しています。エラーは以下の通りである....オブジェクトタイプ「INT」と呼ばいくつかの修正が必要ですSurfaceAreaとLateralArea
の関数または関数ポインタはバイナリ表現(「ダブル」と「ダブル」)
無効オペランドありません
私のコードは、あなたが乗算演算子を省略することはできませんので、2(bottombase + topbase)
が間違っている下記....
#include <iostream>
using namespace std; //allows me to use cout and cin w/o typing std in the main
int main(int argc, const char * argv[])
{
double height; //initialzing my variables
double bottombase;
double topbase;
double volume;
double LateralArea;
double SurfaceArea;
cout << "Please type in the height: "; //asking users for information in order to find volume, and surface area
cin >> height;
cout << "Please type in the length of one side of the bottom base: ";
cin >> bottombase;
cout << "Please type in the length of one side of the top base: ";
cin >> topbase;
volume = height * bottombase * topbase;
cout << "Your volume is: " << volume << endl;
LateralArea = 2(bottombase + topbase) * sqrt(((bottombase-topbase)/2)^2 + height^2);
SurfaceArea = LateralArea1 + bottombase^2 + topbase^2;
cout << "Your surface area is: " << SurfaceArea << endl;
return 0;
}
'2(ボトムベース+トップベース)'は '2 *(ボトムベース+トップベース)'でなければなりません。 '^'はビットごとに排他的です。代わりに 'pow'を使うか、それだけで数値を乗算してください –