0
関数を使用して2次方程式の出力を計算するプログラムを作成しようとしていますが、Dev C++は "[エラー] 1 exit status "と表示されます。 私はC++の初心者です。もし愚かな誤りがあれば、事前に申し訳ありません。"[エラー] ldは1つの終了ステータスを返しました"
#include <iostream>
#include <cmath>
using namespace std;
float equation1 (float, float, float);
float equation2 (float, float, float);
main()
{
float a, b, c, Res1, Res2;
cout << "Insert the parameters of the equation.\n";
cin >> a >> b >> c;
if (a == 0)
{
Res1 = b/c;
cout << "It's a 1st degree eq. and the result is " << Res1 << endl;
}
else
{
Res1 = equation1 (a, b, c);
Res2 = equation2 (a, b, c);
cout << "The results of the eq. are " << Res1 << " and " << Res2 << endl;
}
system ("pause");
return 0;
}
float equation1 (double a, double b, double c)
{
float D, Res1;
D = (b * b) - 4 * a * c;
Res1 = (- b + sqrt(D))/(2 * a);
return Res1;
}
float equation2 (double a, double b, double c)
{
float D, Res2;
D = (b * b) - 4 * a * c;
Res2 = (- b - sqrt(D))/(2 * a);
return Res2;
}
ようこそスタックオーバーフロー。 [The Tour](http://stackoverflow.com/tour)を読み、[ヘルプセンター](http://stackoverflow.com/help/asking)の資料を参考にしてください。ここに聞いてください。 –
あなたはおそらく 'int main(){...}'を書くつもりだと思います。次に、リンカは 'equation1(float、float、float)'の定義を見つけられませんでした。同様に 'equation2(float、float、float)'の定義も見つかりませんでした。定義された関数 'float equation1(double、double、double)'は最初の宣言をオーバーロードすることに注意してください。 – WhiZTiM
@WhiZTiM過負荷を避けるにはどうすればよいですか? – Sam