Reading of coefficients

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

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.

? Form of submission: Two C++ source files named asisgn1.cpp (with main() program) and

funcs.cpp (with functions) should be placed in your account on sanibel in a directory named

assigns (created in your user directory); in addition, the makefile should also be placed there

Reference no: EM13168212

Questions Cloud

Properties in glass and soil examined for evidence : How are the properties in glass and soil examined for evidence? Why are glass and soil examined when present at a crime scene?
Physical property and chemical property : Define the terms “physical property” and “chemical property” as they pertain to crime scene investigations. What properties, physical or chemical, in glass and soil specimens from a crime scene are investigated? How are the properties in glass and so..
Directions for assignment : With today’s computers, the right to privacy is an especially challenging problem. Corporate privacy and the privacy of individuals is a major concern of the Federal Government.
Scope and lifetime are distinct : Scope and lifetime are distinct yet related issues in programming languages. Languages can sometimes make design decisions that cause a conflict between the scope and the lifetime of variables. Java's decision to allow classes to be defined inside..
Reading of coefficients : 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.
Automobile customers are billed : Suppose automobile customers are billed at the rate of $35 per hour for labor. Also, costs for parts and supplies are subject to a 5% sales tax. Write a program to print out a simplified bill.
Movie should be represented : Each movie should be represented by an object of type Movie. The Movie class must provide two public fields: title and category. Both of these fields should be Strings. The class should also provide a
Write in c++. read an inputfile.txt : write in C++.  read an inputFile.txt which contains integers that are virutal addresses, and I am suppossed to translate that into physical addresses using a page table and a transition lookaside buffer
Create a quick wedding program in indesign : create a quick wedding program in Indesign. Are there any websites with templates for wedding programs for Indesign? I am using Indesign CC.

Reviews

Write a Review

C/C++ Programming Questions & Answers

  Complete the 8 queens 2 dimensional array

Complete the 8 queens 2 dimensional array program with backtracking. please change the below program using backtracking  and please run before posting it . the program suppose to print 92 solution . amd also comment before each line to better unde..

  Write a program to find the middle element in a linked list

1. Write a program to check if there is a loop in a linked list. Create a loop in a linked list and use your method 'isLoop' to identify that the loop exists. The method isLoop should return a Boolean type.2.

  Create a calling module name and parameters

Create a calling module name and parameters for the following. (Remember that the asterisk before the parameter name indicates a call-by-reference parameter.

  Deal two cards at a time

Deal two cards at a time, print them out.- Check if they are identical, have just the same rank or just same suit or are completely.different. Print out a message indicating the result of your comparison.

  The counter each time it''s clicked

Write a simple script that contains a button and a counter in a div. The button's event handler should increment the counter each time it's clicked.

  Dealerships are awarded the rebate

Dealerships are awarded the rebate on a quarter-by-quarter basis, only for quarters where their actual sales exceeded expected volumes for that quarter. Expected sales volumes for each quarter are as follows:

  Reverses the characters in a character array

Write the function reverseit that reverses the characters in a character array. You must also write main that calls reverseit.

  Write the entire definition for the main function

Write the entire definition for the main function that prints out all of the command-line arguments on its own line.

  Write a program to find out all 3-digit

Write a program to find out all 3-digit Narcissistic number. A number n is a 3-digit Narcissistic number if: (a) 100   n   999, (b) The sum of its own digits each raised to the power of 3 equals to itself. For example: 153 is a Narcissistic number ..

  Determine order in which constructors of class will execute

Suppose that an object of class three enters its scope, so the constructors of theses classes will execute. Determine the order in which the constructors of these classes will execute.

  Write a program that declares three one dimensional

Write a program that declares three one dimensional arrays named miles, gallons, and mpg . Each array should be declared in main( ) and should be capable of holding ten double

  Computing value of the return statement

In the following code snippet, what is the value of the return statement for x = 4 and n = 4? int foo(int x, int n)

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