How to write a program in c++ to solve linear equation ax+b=0?

its a university task…i highly recommend you give d complete program

include
int main()

int the, b, back button;
cout<<"enter values for a and b:";
cin>>a>>b;
x=-b/a;
cout<<"value with x is"<<x<<endl;

Here’s the code anyone need

int major ()

drift a;
drift b;
drift x;
cout <<"Solve linear equation, first diploma, with 1 unknown.\ n";
cout <<"ax + b = 0 \ n";
announc:
cout <<"Enter value of a:";
cin>> the;
if (cin.fail ())
cout <<"Error" <<endl;
cout <<"Enter worth of b:";
cin>> b;
if (cin.fail ())
cout <<"Error" <<endl;
if (a == 0 & & b == 0)

cout <<"There are infinitely quite a few solutions \ n";
goto announc;

else if (a == 0 & & b! = 0)

cout <<"There are no remedies for \ n";
goto announc;

else

back button =- b / some sort of;
cout <<"x =" <<x<<endl;

Thank you, hope that helps

There are extensive different tactics.For instance, you could practice it directly or you can actually do it by Newton’s method.You’re planning to have to allow us extra to be on.Also, we you should not do your current homework to suit your needs.So reveal specifically the thing you need help using.

Leave a Reply