Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

(Algebra: solve 2 2 linear equations) You can use Cramers rule to solve the following 2 2 system of linear equation: ax + by =

(Algebra: solve 2 2 linear equations)

You can use Cramers rule to solve the following 2 2 system of linear equation:

ax + by = e

cx + dy = f

x = (ed - bf) / (ad - bc)

y = (af - ec) / (ad - bc)

Write a function with the following header:

void solveEquation(double a, double b, double c, double d,

double e, double f, double& x, double& y, bool& isSolvable)

If ad - bc is 0, the equation has no solution and isSolvable should be false.

Write a program that prompts the user to enter a, b, c, d, e, and f and displays the result.

If ad - bc is 0, report that The equation has no solution.

This is what I have so far:

#include #include

using namespace std;

void solveEquation(double a, double b, double c, double d, double e, double f, double& x, double& y, bool& isSolvable) // Ask the user to enter the 6 numbers

cout << "Enter a: "; cin << a; cout << "Enter b: "; cin << b; cout << "Enter c: "; cin << c; cout << "Enter d: "; cin << d; cout << "Enter e: "; cin << e; cout << "Enter f: "; cin << f;

if (a*d - b * c == 0) { isSolvable == 0; cout << " The equation has no solution." << endl; } else { isSolvable == 1; x = (e*d - b * f) / (a*d - b * c); y = (a*f - e * c) / (a*d - b * c); cout << " x is: " << x << "and y is: " << y << endl; } return 0; }

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

How To Build A Million Dollar Database

Authors: Michelle Bergquist

1st Edition

0615246842, 978-0615246840

More Books

Students also viewed these Databases questions

Question

Identify A-G: 1. CH3CCI AlCl3 . 1.03, -78 C

Answered: 1 week ago