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
Consider the eight bit signed binary number 1110 0101. Convert it to signed decimal from assuming the signed binary number is re
alukav5142 [94]

Answer:    -26

Explanation:

We have:  1 1 1 0   0 1 0 1

Since it’s one’s complement representation, then we check the very first digit to state if the number is negative or positive. Since the very first digit to the left is 1, then the number will be negative.

When it is negative, we now flip the bits, so that we get:

0 0 0 1   1 0 1 0

Notice we just turn the 1’s into 0’s and vice versa.

We now convert this binary into decimal:

We assign to each digit the corresponding power of 2.  

See it in a table:

\begin{matrix}0&0&0&1&1&0&1&0\\2^7&2^6&2^5&2^4&2^3&2^2&2^1&2^0 \end{matrix}

Then multiplying each digit by its corresponding power of 2 and then adding the results, we get:

2^4+2^3+2^1

We get:

16+8+2=26

Since we stated that the number is negative, then, the final result is: -26

4 0
3 years ago
When entering a formula or function into a cell, most spreadsheet programs require that you begin with some type of symbol, usua
olga_2 [115]
This is a false statement, if that's the question.
4 0
3 years ago
How do you know how much space is on the computer
Vladimir79 [104]
Depending on which computer you have you can go into settings and check the data tab or it should be on the box how much it comes with :)
5 0
4 years ago
Read 2 more answers
There are spoilers that doctor brenner is back in stranger things four and eleven is going back. Do you believe it or no? Make s
Svetlanka [38]
Wait Doctor Brenner is coming back?!?! Wait omg when??
5 0
3 years ago
Compare and contrast the features of the four computer career fields. Write a paragraph on each and specify how the four career
tresset_1 [31]

Answer:

don`t know

Explanation: help me

7 0
4 years ago
Other questions:
  • Why would you use a topic web?
    7·2 answers
  • Assume that a file containing a series of integers is named numbers.dat and exists on the computer's disk. design a programt hat
    15·2 answers
  • In a paragraph of no less than 125 words, explain what netiquette is and how it improves efficiency and productivity in the work
    14·1 answer
  • Will technology be the destruction or salvation of human-kind
    13·2 answers
  • Select the correct word to complete the sentence
    11·2 answers
  • Software que busca, detecta y elimina malware tipo espía; puede instalarse en la computadora de manera aislada o en conjunto con
    11·1 answer
  • Join my me et.goo gle.etj-dovn-kds​
    11·1 answer
  • Slack how to enable direct message to outside workspace
    15·1 answer
  • The BCD number for decimal 473 is( ). a) 111011010; b) 010011110011; c) 010001110011; d)0010110110​
    15·1 answer
  • Html is a markup language that lets you identify common sections of a web page
    8·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!