#include <iostream> #include <string> using namespace std; int main() { //initialize variables int a1; int b1; int c1; int a2; int b2; int c2; double x; double y; //prompt and get input cout << "Welcome to Robert's Simultaneous Equation Solver! " << "\n"; cout << "Please enter a1, b1, c1 (seperated by spaces): "; cin >> a1; cin >> b1; cin >> c1; cout << "Please enter a2, b2, c2 (seperated by spaces): "; cin >> a2; cin >> b2; cin >> c2; if ((a1 == a2) && (b1 == b2) && (c1 == c2)) { cout << "Your inputs create identical lines."; } else if ((a1 * b2 - a2 * b1) == 0) { cout << "Your inputs create parallel lines."; } else { //do math x = ( c1 * b2 - c2 * b1 ) / ( a1 * b2 - a2 * b1 ); y = ( a1 * c2 - a2 * c1 ) / ( a1 * b2 - a2 * b1 ); //output cout << "The solutions to the equations: " << "\n"; cout << a1 << "x + " << b1 << "y = " << c1 << "\n"; cout << a2 << "x + " << b2 << "y = " << c2 << "\n"; cout << "is x = " << x << " and y = " << y; //pause and exit getchar(); getchar(); return 0; }}

needs to do this

Welcome to Robert’s Simultaneous Equation Solver.

Please enter a1, b1, c1 (separated by spaces): input: 1 2 2

Please enter a2, b2, c2 (separated by spaces): input:1 -2 -12

The solution of the equations:

1x + 2y = 2

1x + -2y = -12

is x = -5.00 and y = 3.50