online compiler and debugger for c/c++

code. compile. run. debug. share.
Source Code   
Language
/****************************************************************************** Welcome to GDB Online. GDB online is an online compiler and debugger tool for C, C++, Python, Java, PHP, Ruby, Perl, C#, VB, Swift, Pascal, Fortran, Haskell, Objective-C, Assembly, HTML, CSS, JS, SQLite, Prolog. Code, Compile, Run and Debug online from anywhere in world. *******************************************************************************/ #include <iostream> #include <cmath> // pour sqrt using namespace std; int main() { cout << "Equation du second degré" << endl; // Déclaration des variables double a = 0, b = 0, c = 0; double delta = 0, x = 0, x1 = 0, x2 = 0; // Saisie de a, b et c cout << "RESOLUTION EQUATION 2 DEGRE FORME aX² + bX + c = 0" << endl; cout << "Saisir a : "; cin >> a; cout << "Saisir b : "; cin >> b; cout << "Saisir c : "; cin >> c; // Vérification de a (éviter division par 0) if (a == 0) { cout << "Ce n'est pas une équation du second degré (a = 0)." << endl; return 0; } // Calcul du discriminant delta = b * b - 4 * a * c; cout << "Δ = " << delta << endl; if (delta == 0) { x = -b / (2 * a); cout << "Delta nul → une seule racine double : x = " << fixed << setprecision(3) << x << endl; } else if (delta > 0) { x1 = (-b - sqrt(delta)) / (2 * a); x2 = (-b + sqrt(delta)) / (2 * a); cout << "Delta positif → deux racines réelles :" << endl; cout << "x1 = " << fixed << setprecision(3) << x1 << "\t x2 = " << fixed << setprecision(3) << x2 << endl; } else { cout << "Delta négatif → pas de solutions réelles." << endl; } return 0; }

Compiling Program...

Command line arguments:
Standard Input: Interactive Console Text
×

                

                

Program is not being debugged. Click "Debug" button to start program in debug mode.

#FunctionFile:Line
VariableValue
RegisterValue
ExpressionValue