Ich bin sehr neu in der Programmierung und Codierung, so dass ich mit Problemen konfrontiert bin, von denen ich einige nicht zu verstehen scheinen. Ich habe wirklich nach Antworten gesucht, aber vergebens.Anfänger Q auf Compiler-Fehler
Der Compiler 2 erwähnt Fehler:
Funktion 'intmain()':
und
erwartet ';' vor '{' token
#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") ;
}
Vielen Dank für Ihre Hilfe. Ich werde das Problem beheben, indem ich die Lösungen benutze, die Sie mir zur Verfügung gestellt haben. –