#include <iostream>
#include <math.h>
using namespace std;
int main ()
{
int a, b, c, d;
long double x, y;
cout << "abc-formule. ax^2 + bx + c\n";
cout << "Voer a b en c (gehele getallen) in met een spatie";
cin >> a >> b >> c;
cin.get();
d = (b ^ 2) - 4 * a * c;
if (d < 0)
cout << "Deze formule is niet mogelijk";
x = (-b + long double sqrt( long double d )) / (2 * a);
cout << "X is " << x << "of\n";
y = (-b - long double sqrt( long double d )) / (2 * a);
cout << "X is " << y;
cin.get();
}
Ik krijg 2 errors:
1>d:\ikt\visual studio 2008 projects\projects\cin2\cin2\cin2.cpp(15) : error C2062: type 'long double' unexpected
1>d:\ikt\visual studio 2008 projects\projects\cin2\cin2\cin2.cpp(17) : error C2062: type 'long double' unexpected
Ik krijg 2 errors: