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]
3 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]3 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
An example of what you can post that shows kindness to other
harina [27]

Answer:

everybody is awesome

Explanation:

5 0
2 years ago
What is the python print of (“5”+”7”)?
Firdavs [7]

Answer:

57

Explanation:

Since the 5 and the 7 don't represent integers instead they represent strings so it would come out as 57 hope I helped!

4 0
2 years ago
Where do today's computers store almost all motherboard configuration data?
sergij07 [2.7K]
In the mother board of the back door next to the restroom 5 steps left
3 0
3 years ago
Write any 2 differences between implicit variables and explicit variables.​Plz tell :' (
Marrrta [24]
Explicit is stated very clearly
Implicit is implied
Explicit leaves no room for confusion
Implicit doesn’t have to be directly stated
3 0
3 years ago
Qbasic program to accept 10 numbers and to find their sum. <br>​
sesenic [268]

Answer:

the answer is 5

Explanation:

6 0
3 years ago
Other questions:
  • In order to plan George’s birthday, his father gave him a list of people who attended his birthday for the last five years. What
    8·2 answers
  • Using the syntax in section 2.3, write a command delete_all_rights (p, q, s). this command causes p to delete all rights the sub
    13·1 answer
  • The transport layer protocol used by the tcp / ip suite that does not provide guarantees on ordering or confirmation of receipt
    7·1 answer
  • Free 100 point to first to answer
    5·2 answers
  • How many positions there are in the media and design department?
    14·2 answers
  • When two or more tables share the same number of columns, and when their corresponding columns share the same or compatible doma
    12·1 answer
  • write a script that creates and calls a stored procedure named insert_category. first, code a statement that creates a procedure
    10·1 answer
  • Literally no one helps answer my questions so this website is pointless.... : /
    11·1 answer
  • Computer application just help me with it all ?
    8·1 answer
  • The computer stores currently used programs and data in ________.
    9·2 answers
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!