私はプログラミングとコーディングがとても新しいので、私は理解できないような問題に直面しています。私は本当に答えを探しましたが無駄です。 ')(intmain' 関数で初心者のQはコンパイラエラー
:
コンパイラは2つのエラーを挙げる
と
予想前';' '{' トークン
#include<iostream>
#include<math.h>
using namespace std;
main()
{
float a, b, c, D, x1, x2, x;
cout<<"enter the value of a :";
cin>>a;
cout<<"enter the value of b :";
cin>>b;
cout<<"enter the value of c :";
cin>>c;
D= b*b-4*a*c;
if(D>0)
{
x1= (-b-sqrt(D))/(2*a);
x2= (-b+sqrt(D))/(2*a);
cout<<"the roots of the equation are"<<x1<<"and"<<x2<<" \n";
}
else if (D=0)
{x= -b/(2*a);
cout<<"the double root of the equation is"<<x<<" \n";
}
else (D<0)
{
cout<<"no solution \n:";
}
system("pause") ;
}
ありがとうございました。あなたが私に提供したソリューションを使用して問題を解決します。 –