- 1

Pls help how can me let my code repeated as I like in c++

C++ beginner problem

17th Mar 2022, 5:23 PM
Zineb Nafil
12 odpowiedzi
0
Normal one resolving eq second degrees
17th Mar 2022, 5:35 PM
Zineb Nafil
0
#include<iostream> #include<math.h> using namespace std; int main() { float a,b,c,x1,x2,delta; cout << "a="; cin >> a; if (a==0) cout<<"erreur math"; else {cout<<"new value a:"; cin>>a;} cout << "b=";cin >> b; cout << "c=";cin >> c; delta = b*b-4*a*c; cout<<"Delta="<<delta<<endl; cout<<"put another value for a"; delta = b*b-4*a*c; cout<<"Delta="<<delta; if(delta<0) cout<<"pas de solution"; else if(delta==0); cout <<"x1=x2="<< -b/(2*a); if(delta>0)cout<<"Delta="<<delta; else { x1=(-b-sqrt (delta))/(2*a) ; x2=(-b+sqrt(delta))/(2*a); cout<<"x1="<<x1; cout<<"x2="<<x2; } }
17th Mar 2022, 5:37 PM
Zineb Nafil
0
Also it not verify if a ==0 I don t know how to fix it any idea???
17th Mar 2022, 5:38 PM
Zineb Nafil
0
I think I must add instructions here for that make sens because I want the code to stop when it found a=0
17th Mar 2022, 6:43 PM
Zineb Nafil
0
Tkx a lot
17th Mar 2022, 6:46 PM
Zineb Nafil
0
Ok
18th Mar 2022, 1:52 PM
Zineb Nafil
- 1
Ok tkx
17th Mar 2022, 6:42 PM
Zineb Nafil
- 1
Or just recommand the user to put another value of a and continue the program for step I don't know how to make it
17th Mar 2022, 6:45 PM
Zineb Nafil