Assignment 6 - Assignment 6 1. Write a program to compute...

Info iconThis preview shows pages 1–2. Sign up to view the full content.

View Full Document Right Arrow Icon

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
This is the end of the preview. Sign up to access the rest of the document.

Unformatted text preview: Assignment 6 1. Write a program to compute the roots of a quadratic equation ax 2 + bx + c = 0, where a, b, and c are real numbers. Structure your program as described below. A. The input file is named input_equations.txt which contains the three coefficients of an equation in each line as below: 1.0 -3.0 2.0 1 0 -4.84 1 0 1 You may create more inputs if you need. Open pico input_equations.txt 1.0 -3.0 2.0 1 4.84 1 1 B. Write a function compute_roots that has five parameters: a : Coefficient of x2 b : Coefficient of x c : constant term *root1 : pointer to a double type variable *root2 : pointer to a double type variable The function updates the memory locations pointed to by root1 and root2 with the two roots of the quadratic equation, if they have real-valued roots. If the roots are complex, then the memory locations are left unchanged. The function returns a value 1 if the roots are real-valued, otherwise returns 0....
View Full Document

This homework help was uploaded on 04/03/2008 for the course ECE 175 taught by Professor Grubbs during the Spring '08 term at University of Arizona- Tucson.

Page1 / 3

Assignment 6 - Assignment 6 1. Write a program to compute...

This preview shows document pages 1 - 2. Sign up to view the full document.

View Full Document Right Arrow Icon
Ask a homework question - tutors are online