The actual solution of the equation shall be done

Assignment Help C/C++ Programming
Reference no: EM13168417

Write a C++ program (without a use of global variables) to solve a single quadratic equation of the form:

a*x2 +b*x+c=0

with the following specific requirements:
1) Reading of coefficients a, b, c shall be done by a function named readCoeffs(). They shall be entered

as double’s from the keyboard by an operator, after prompt, as follows:
Enter coefficient a: <operator enters a>
Enter coefficient b: <operator enters b>
Enter coefficient c: <operator enters c>
<one empty line should follow this sequence of three prompts>
and returned to the caller as a structure with 3 fields.
2) The actual solution of the equation shall be done by a function named equSolver(), which takes three coefficients as parameters and returns a structure of three fields: two roots (if they exist) and a boolean indicator, whether the roots do exist.

3) The function equSolver() shall call another function named discr() to calculate and return the discriminant necessary to compute the roots.

4) After equation is solved, another function named outResults() shall display on the screen results of the calculation in the following format:

    a)  If the solutions (roots) exist in the real domain, the output shall look as follows:

                Quadratic equation with the following coefficients:
                a: <value>;  b: <value>;  c: <value>
                has the following roots
                Root1: <value>;  Root2: <value>;

    <one empty line should follow this sequence of lines>

    b)  In case there are no solutions (roots) in the real domain, the output shall look as follows:

    Quadratic equation with the following coefficients: a: <value>; b: <value>; c: <value>
    has no roots in the real domain.
    <one empty line should follow this sequence of lines>

5) All functions shall be placed in a file separate from main(), named funcs.cpp, and a makefile shall be constructed and used for compilation.

Reference no: EM13168417

Questions Cloud

Which gives the order for first ionization energies smallest : which gives the order for first ionization energies smallest to largest
Calculate the number of moles of each substance : A mass of 46 g of solid sodium reacts with 38 g of flourine gas to produce 84 g of sodium flouride, Na F.
What did she most likely do incorrectly in her experiment : A student found that her mixture was 15% NH4Cl, 20% NACL, and 75% SiO2. Assuming her calculations are correct, what did she most likely do incorrectly in her experiment?
What will be the molarity of a compound : What will be the molarity of a compound (1 litre) with a molecular weight of 169 and purity as 41%.
The actual solution of the equation shall be done : The actual solution of the equation shall be done by a function named equSolver(), which takes three coefficients as parameters and returns a structure of three fields: two roots (if they exist) and a boolean indicator, whether the roots do exist.
Design an asynchronous base 14 counter : Design an asynchronous base 14 counter that counts through the natural binary sequence from 0 (0000) to 13 (1101) and then returns to zero on the next count.
Program that takes the amount a person has spent : Program that takes the amount a person has spent and determines the discount ($15 per $175 spent).
Beyond corporate responsibility : What examples from the readings or audio lectures stick out the most in your mind? Why? Has your perception of service learning changed since our first week?
Adt for a two color double stack adt consists of two stacks : design an adt for a two color double stack adt that consists of two stacks one red and one blue and has its operations color coded versions of the regular stack adt operations.

Reviews

Write a Review

C/C++ Programming Questions & Answers

  Write c program to find smallest-largest values

Write a program c that will find the smallest, largest and average values in a collection of N numbers.Get the value of N before scanning each value in the collection of N numbers.

  Three dimensional array representing parking spaces

start with code in the file lab.cpp. This program works with a three dimensional array representing parking spaces in a parking garage on several floors. The code is incomplete. The functions "main", "display" and "showSpace" are complete. Your job i..

  The process function will then need

The process function will then need to find the time the person waited by calling the time function and finding the difference between the start and end timestamps. Save this time to an accumulator so that in the end you can find the average wait tim..

  Array of integers declared-initialized to number of tickets

Array of integers named parkingTickets has been declared and initialized to number of parking tickets given out by city police each day as beginning of current year.

  The program should support a ''new'' feature

Write a GUI program that represents a simple Notepad clone. The program should support a 'new' feature that clears the text buffer, a save feature that writes to a file using a PrintStream

  Program that takes a number between

Write a program that takes a number between -121 and 121 and output that number in the format of power of 3 (1,3,9,27)example:13 = 9+3+1

  Iterative programming problem solving approaches

Write a recursive function void reverse ( ) that reverse a sentence

  Write a program that will read in number of 2 point basket

Write a program that will read in the number of 2 point baskets and the number of 3 point baskets a player makes.  Print the number of each baskets and the total number of points scored.

  Integer arguments representing feet

A constructor that will take a single integer argument representing a whole number of feet • A constructor that will take two integer arguments representing feet and inches respectively • A constructor that will take three integer arguments represent..

  Program that asks the user to enter the number of miles

Write a C - program that asks the user to enter the number of miles traveled and the number of gallons of gasoline consumed. It should then calculate and display the miles-per-gallon value. Confine your output to 1 decimal place.

  Use the getint and getintwithinrange methods

Use the getInt and getIntWithinRange methods to validate that each score ranges from 1 through 100 and add code that discards any extra entries at the prompt that asks if you want to enter another score to the application below.

  Native method with deadlock detection and recovery

The naïve method with deadlock avoidance and the naïve method with deadlock detection and recovery - what will you measure and compare in order to determine the winner or which is better

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