1answer.
Ask question
Login Signup
Ask question
All categories
  • English
  • Mathematics
  • Social Studies
  • Business
  • History
  • Health
  • Geography
  • Biology
  • Physics
  • Chemistry
  • Computers and Technology
  • Arts
  • World Languages
  • Spanish
  • French
  • German
  • Advanced Placement (AP)
  • SAT
  • Medicine
  • Law
  • Engineering
Gemiola [76]
4 years ago
12

Write the definition of a function named quadratic that receives three double parameters a, b, c. If the value of a is 0 then th

e function prints the message "no solution for a=0" and returns. If the value of "b squared" – 4ac is negative, then the code prints out the message "no real solutions" and returns. Otherwise the function prints out the largest solution to the quadratic equation. The formula for the solutions to this equation can be found here: Quadratic Equation on Wikipedia.
Computers and Technology
1 answer:
podryga [215]4 years ago
6 0

Answer:

Following are the program in the C++ Programming Language.

#include <iostream> //header file

#include <cmath> //header file

using namespace std; //namespace

//define function

void quadratic (double a, double b, double c)

{

 double x,y; //set double type variables

 //check a==0

 if (a==0)

 { //then print message

   cout << "no solution for a=0";

 }

 //check if solution is less than 0

 else if ((b*b - 4*a*c) < 0)

 { //print message

   cout << "no real solutions";

 }

 //otherwise

 else

 {//solve the following quadratic equation

   x = (-b + sqrt( b*b - 4*a*c)) /(2*a);//in term of x

   y = (-b - sqrt(b*b - 4*a*c)) / (2*a);//in term of y

   //check x is greater than y

   if (x > y){

     cout<<x; //print the value of x

   }

   //otherwise

   else{

     cout<<y;//print the value of y

   }

 }

}

//define main method

int main() {

 //set double type variables and assign their value

 double x=10, y=50, z=-205;

 //call the function

 quadratic(x,y,z);

}

<u>Output</u>:

2.67204

Explanation:

Here, we define a function "quadratic" and pass three double data type variables i.e., "a", "b" and, "c" inside the function.

  • Set two double type variable i.e., "x", "y".
  • Set the if conditional statement and check the conditions is the variable a is equal to the 0 then, print the message or check another condition is the solution of the equation "b*b - 4*a*c" is less than 0, then print the message.
  • Otherwise, solve the quadratic equation in terms of the variable x or the variable y.
  • Again check the condition inside the else part is the variable x is greater than the variable y then, print the value of x otherwise print the value of y.

Finally, we define the main function inside it we set three double type variables i.e., "x", "y" and, "z" and initialize value 10, 50 and, -250 then, call the function and pass the variables x y z in its parameter.

You might be interested in
Which resource helps a user access a cloud service?
Gala2k [10]
The answer is computer networking.
6 0
3 years ago
Read 2 more answers
Which one of the following types of statements is an instruction to replace the existing value of a variable with another value?
Greeley [361]

Answer:

The answer is "Option c"

Explanation:

The assignment is the statement used to determine the value of the programming variable. It is also regarded as the same sign indicating the function (=) in the operator. This operand works by allocating the operand's value to the right-hand side, and other choices are not correct that can be described as follows:

  • In option a, It is a keyword that is used to update table details.
  • In option b, It is part of programming, which is used to the declared variable.
  • In option d, It is used to assign value in variable.  
8 0
4 years ago
A page can have High needs met rating even if it is not related To the topic of the query​
Lisa [10]

Answer: A page can have the high needs met rating even being not related to the topic of the query is False. A needs met rating is completely based on how well the resulting landing page meets the related query.

Explanation:

3 0
4 years ago
Who tryna play among us
harkovskaia [24]

Answer:

I'm doing a digital media test right now

8 0
4 years ago
Read 2 more answers
Janice is making her resume in which section should she include information about her previous employers , positions held , and
Volgvan

Generally, Janice should post information about her past employment in the Experience section, also often called as Professional Experience. The information that she should include is the name of the organization or company which previously employed her, her positions there, length of each position, and a description of what she did in the position.

4 0
3 years ago
Other questions:
  • Write an application program that creates and prints a random phone number of the form XXX-XXX-XXXX. Include the dashes in the o
    5·1 answer
  • How to cite a website, like asha.org?
    6·1 answer
  • Give a big-O estimate the number of operations, where an operation is a comparison or a multiplication, used in this segment of
    10·1 answer
  • What is the purpose of an exhaust emission system
    6·1 answer
  • Someone please help me? Thanks!
    10·2 answers
  • Please help with attached file
    8·2 answers
  • The requester of sensitive information should not receive access just because of his or her clearance, position, or rank. The re
    15·1 answer
  • When drawing multiple objects on the same slide they cannot overlap<br> true<br> false
    8·2 answers
  • Join the class <br> The class code is hello112
    5·2 answers
  • A hacker corrupted the name:IP records held on the HOSTS file on a client, to divert traffic for a legitimate domain to a malici
    11·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!