Solve a single quadratic equation of the form

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

Question: 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:

Part 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.

Part 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.

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

Part 4) After equation is solved, another function named outResults() shall display on the screen results of the calculation in the following format:
1. a) If the solutions (roots) exist in the real domain, the output shall look as follows:
2. Quadratic equation with the following coefficients:
3. a: <value>; b: <value>; c: <value>
4. has the following roots
5. Root1: <value>; Root2: <value>;
6.
<one empty line should follow this sequence of lines>
7. 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>

Part 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.

Please show me all the working and provide the answer.

Reference no: EM13694480

Questions Cloud

Conditions of employment and company expectations : Social networking has forced businesses to amend some of their employees' conditions of employment and company expectations.
Compare and contrast the traditional marketing : Crowd sourcing has been predicted to be the future of marketing, advertising, product design etc. Companies that have used crowdsourcing include Starbucks, InnoCentive,Inc, uTest, etc.
Describe and assess impact of these devices on newspaper : Personal data assistants (PDAs), iPads, and e-Readers have the capability to wirelessly connect to online stores so that their users can purchase books, music, games,read e-Books, read the news, and perform a myriad of other tasks
Determine the security risks with respect to phishing : Mobile banking features have added several advantages for customers. Determine the security risks with respect to phishing, smishing, vishing, cloning, and a lost or stolen Smartphone that have been experienced by the financial services industry ..
Solve a single quadratic equation of the form : Write a C++ program to solve a single quadratic equation of the form - 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 root..
Use of universal quantification : Let L1, L2, ..., Ln be distinct lines in the Euclidean plane, and let A be the set of points formed by intersections of these lines. Characterize A using set notation and quantifiers.
Calculate the area and circumference of a circle : Write a program to move and calculate the area and circumference of a circle. - Calculate function, which passes the radius by value, and get back the area (PI*radius*radius) and circumference (2*PI*radius) of the circle through reference
Write a function named append that accepts three arguments : Write a function named append that accepts three arguments. The first two arguments passed to append are c-strings to be appended (the second c-string is appended to the first). The third argument passed should be the size of the character array ..
Program that computes the monthly loan payment : Write a program that computes the monthly loan payment, given the loan amount (a double value), the interest, as a percent % (a double value), and the number of years to repay the loan

Reviews

Write a Review

C/C++ Programming Questions & Answers

  Create a program, using at least one for loop

Create a program, using at least one For loop, that displays the Sales Amounts made in each of 4 regions (North, South, East, and West) during a three month period.

  What is the output

Suppose that x and y are int variables, z is a double variable, and ch is a char variable. Suppose the input statement is.

  Write a matrix multiplication program

Write a C++, matrix multiplication program which you can instrument to monitor and measure execution time as a function of problem size. Make sure it works in Microsoft Visual Studio.

  Design customized mailing lists for marketing department

Marketing department requires to be able to design customized mailing lists, to send different messages to different types of donors. What system will best meet these requirements?

  How many whole numbers they wish to enter

Write a program, which will ask the user how many whole numbers they wish to enter. The program will then read that many numbers, print them in the order they were entered, sort them in order by increasing value, and print them in sorted order.

  How the project teams and coaches master agile methodology

Analyze how the project teams and coaches master the agile methodology to solve business problems. Highlight the one that you believe is the most effective and support your answer.

  Techniques for information hiding and encapsulation

What techniques did you utilize for information hiding and encapsulation? Are there any improvements you would make? If so, what would they be?

  Write a program to find solutions to the n-queens puzzle

Write a program to find solutions to the n-queens puzzle for various valuesof n. To be specific, test your program for n =4 and n =8.

  Write a loan calculator program

Write a loan calculator program in C++ that displays monthly balances for user-specified loan terms. To be flexible, you decide to specify the loan terms in a file and provide that filename  entered from the keyboard. To keep things simple

  Ng stands for next guess

Where NG stands for next guess and LG stands for last guess. Write a function that calculates the square root of a number using this method. The initial guess will be the starting value of LG .

  State a c program that opens the file

Write a C program that opens the file and firstly stores all the values in an appropriately declared two-dimensional array of integers. It then should analyse this array to find (from the 40 input values) the total number of coursework marks in the..

  Explain how to convert c program to mips program

Convert the following C program to MIPS program. Assuming that i, j, k, f, are stored in registers $s0, $s1, $s2, $s3 already.

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