Reference no: EM13705327
Write a complete C++ program to report on the roots of a quadratic equation ax2 + bx + c = 0, a ≠ 0. The formula for the roots is
-b ± √b2 - 4ac/2a
If the discriminant, b2 - 4ac, is zero, there is a single root. If b2 - 4ac > 0, there are two real roots. If b2 - 4ac < 0, there are two complex roots. For b2 - 4ac >= 0, the program can compute the roots.
Input: The values of a, b, and c are stored in an input file on the h: drive named quadratic.txt.
Processing: A value-returning function will be used to compute b2 - 4ac.
Output: The type and number of the roots (single real root, two real roots, two complex roots) and, if b2 - 4ac >= 0, the root value(s).The output is written to a file on the h: drive named results.txt.
Tip: Use the function pow(x,y), which computes x raised to the power y (xy). If y = 0.5, pow(x,y) gives the square root of x. You need to include the cmath header file to use pow(x,y).
Note: Use the assert function (assert statement) to halt the program if division by zero is about to occur.
What is the mass of air in the cylinder
: The cylinder of a turbocharged diesel engine is filled with air at 30.0 psia and 250°F. When the intake valve closes, cylinder volume is 60.0 in3. The piston moves upward un-til cylinder volume is 4.00 in3, at which time pressure is 1100 psia. What ..
|
The acceleration of a particle is defined by the equation
: The acceleration of a particle is defined by the equation a = -k*sqrt(v), where k is a constant. When t=0, the initial position is xo=0 and the initial velocity is vo=81ft/s. Knowing that v =36ft/s when x=18ft, determine the velocity of the particle ..
|
Determine how to best maximize the amount of net fixed asset
: Analyze the accounting for each fixed asset class using US GAAP and IFRS and determine how to best maximize the amount of net fixed assets.
|
Change in internal energy of nitrogen in a process
: Saturated liquid water at 1.0 MPa is inside a pistoncylinder device, which is heated until all of the water is vaporized. Find the amount of heat transfer needed for this process. Find the change in enthalpy and the change in internal energy of nitr..
|
Program to report on the roots of a quadratic equation
: Write a complete C++ program to report on the roots of a quadratic equation ax2 + bx + c = 0, a ≠ 0. compute the roots.
|
The mass flow rate of the refrigerant
: A small vapor-compression refrigeration unit is to be built into a recreational vehicle and is designed to operate on a 12-volt electrical system. The refrigerator has a cooling capacity of 500 W and uses R-134a. The refrigerant enters the compressor..
|
Write a program that displays the size of a population
: Write a function that calculates the size of the population after a year. To calculate the new population after one year.
|
Money was made in interest over the initial investment
: If a single deposit of $25000 is invested at 1.75% yearly interest, what equal year-end withdrawals can be made each year for 10 years, leaving nothing in the fund after the 10th withdrawal? How much money was made in interest over the initial invest..
|
Measurement of the flow rate of a stream of liquid acetone
: An orifice meter is to be calibrated for the measurement of the flow rate of a stream of liquid acetone. The differential manometer fluid has a specific gravity of 1.10. The calibration is accomplished by connecting the orifice meter in series with a..
|