Program to report on the roots of a quadratic equation

Assignment Help C/C++ Programming
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.

Reference no: EM13705327

Questions Cloud

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 piston­cylinder 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..

Reviews

Write a Review

C/C++ Programming Questions & Answers

  Create program that uses functions and reference parameters

Create program that uses functions and reference parameters, and asks user for the outside temperature.

  Write a program using vectors and iterators

Write a program using vectors and iterators that allows a user to maintain a personal list of DVD titles

  Write the code required to analyse and display the data

Calculate and store the average for each row and column. Determine and store the values for the Average Map.

  Write a webservices application

Write a webservices application that does a simple four function calculator

  Iimplement a client-server of the game

Iimplement a client-server version of the rock-paper-scissors-lizard-Spock game.

  Model-view-controller

Explain Model-View-Controller paradigm

  Design a nested program

How many levels of nesting are there in this design?

  Convert celsius temperatures to fahrenheit temperatures

Write a C++ program that converts Celsius Temperatures to Fahrenheit Temperatures.

  Evaluate and output the value in the given base

Write C program that will input two values from the user that are a Value and a Base with which you will evaluate and output the Value in the given Base.

  Design a base class shape with virtual functions

Design a base class shape with virtual functions

  Implementation of classes

Implementation of classes Chart and BarChart. Class barChart chould display a simple textual representation of the data

  Technical paper: memory management

Technical Paper: Memory Management, The intent of this paper is to provide you with an in depth knowledge of how memory is used in executing, your programs and its critical support for applications.

Free Assignment Quote

Assured A++ Grade

Get guaranteed satisfaction & time on delivery in every assignment order you paid with us! We ensure premium quality solution document along with free turntin report!

All rights reserved! Copyrights ©2019-2020 ExpertsMind IT Educational Pvt Ltd