Home c c plus plus Solve First Degree Equation [C++] Solve First Degree Equation [C++] Author - thinhphamvn January 01, 2023 0 Write a procedure to solve a first order equation ax + b = 0Source Codemain.cppresult>>> Download Source Code (Google Drive) // Write a procedure to solve a first order equation // ax + b = 0 #include void Input(double &x) { std::cout << "\ninput "; std::cin >> x; } void SolveFirstDegreeEquation(double a, double b) { // The equation has the form: b = 0 if (a == 0) { if (b == 0) { std::cout << "\nthe equation has infinitely many solutions"; } else { std::cout << "\nno solution"; } } else { double x = -b/a; std::cout << "\nequation with solution x = " << x; } } int main() { double a, b; Input(a); Input(b); SolveFirstDegreeEquation(a, b); return 0; } Tags c c plus plus Facebook Twitter Whatsapp Newer Older