labprog2-2010_1 - The program should be carefully checked...

Info iconThis preview shows page 1. Sign up to view the full content.

View Full Document Right Arrow Icon
Swinburne University of Technology Faculty of Engineering and Industrial Sciences HES1300 Laboratory worksheet 2: To solve the following simultaneous linear equations, one can calculate the determinant first and then finds the answers using the following formulas: q Dy Cx p By Ax = + = + BC AD - = det det qB pD x - = det qA pC y + - = Write a program which reads A, B, C, D, p and q from console and calculates the determinant. Following that, your program should compute both solutions of the system of linear equations and display the answers.
Background image of page 1
This is the end of the preview. Sign up to access the rest of the document.

Unformatted text preview: The program should be carefully checked and tested, using values of the coefficients which ensure that the determinant is not zero. Make sure that your program will never attempt to divide by a zero or near zero numbers. In this case, the program should print a message to the effect that the two algebraic equations have degenerated to one single equation. Your program may look like: #include <stdio.h> int main() { float A,B,C,D,p,q,det; … … return(0); }...
View Full Document

This note was uploaded on 09/29/2010 for the course C++ c taught by Professor Lauren during the Three '10 term at Swinburne.

Ask a homework question - tutors are online