#include <iostream>
using namespace std;
const double PI = 3.14;
void ReadinputData(int& a, int& b){
cout << " Give me the height of the Cylinder: ";
cin >> a ;
cout << " Give me the radious of its base: ";
cin >> b ;
}
void ComputetheResults(int a,int b,int &x,int &y){
x= 2*PI*b*a;
y= PI*a*b*b;
}
void DisplayAnswers(int a, int b){
cout<< "the surface are of the cylinder is: "<< a<< endl;
cout<< "the volume of the cylinder is: "<< b << endl;
}
int main()
{
int h,r,A,V;
h=0;
r=0;
A=0;
V=0;
ReadinputData(int h, int r);
ComputetheResults(int h,int r,int &A,int &V);
DisplayAnswers(int A,int V);
}
エラーは次のとおりです。私の主な機能には、 "intの前に予想される一次式"という種類のエラーがあります。どうしましたか?
--------------ビルド:EEEEでのデバッグ---------------
コンパイル: 'int型のmain()' 関数で: /ホーム/ vaios /デスクトップ/ ertt/eeeeee/EEEE /メイン/home/vaios/Desktop/ertt/eeeeee/eeee/main.cpp main.cppに .cpp:39:15:error: 'int'の前に一次式が必要です。 /home/vaios/Desktop/ertt/eeeeee/eeee/main.cpp:39:22:エラー: 'int'の前に一次式がありません。 /home/vaios/Desktop/ertt/eeeeee/eeee/main.cpp:40:19:error:予期されるprimary-expression beforeの前にint ' /home/vaios/Desktop/ertt/eeeeee/eeee/main.cpp:40:25:エラー:' int 'の前に予期した一次式があります。 /home/vaios/Desktop/ertt/eeeeee/eeee/main。 cpp:40:31:error: 'int'の前に一次式が必要です /home/vaios/Desktop/ertt/eeeeee/eeee/main.cpp:40:38:エラー: 'int'の前に一次式が予期されています /41:16:エラー: 'int'の前に一次式が予期される /home/vaios/Desktop/ertt/eeeeee/eeee/main.cpp:41:home/vaios/Desktop/ertt/eeeeee/eeee/main.cpp: 22:エラー: 'int'の前に予期される一次式 ステータス1(0分、0秒)でプロセスが終了しました エラー8件、警告0件
この種の数学では、 'int'sではなく' float'または 'double'sを使用してください。 'int'sを使うと、非常に不正確な結果になります。 :) –