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
Question 4 Multiple Choice Worth 5 points)
Morgarella [4.7K]

The correct answer is Boolean logic.

Booleans are true or false statements.

An example of a while loop is:

while 1 < 5:

   #do something.

The Boolean statement is 1 < 5 which evaluates to true because 1 is less than 5.

I hope this helps!

3 0
3 years ago
Create a text file named employee.dat containing the following data: b. Write a C++ program to read the employee.dat file create
Paul [167]

Answer:

1000 500 250 125 the output

Explanation:

write a program using integers userNum and x as input,  userNum divided by

x four times.  EX : If  the input is 2000 2 the output is 1000 500 250 125

8 0
3 years ago
Is a trade group that promotes wireless technology and owns the trademark for the term “wi-fi”
ivann1987 [24]

Answer:

1. Wifi Alliance

2. Cells

Hope this helps! Have a great day! :)

7 0
4 years ago
Read 2 more answers
DSL signals travel over telephone lines using the 300 to 3300 Hz frequency range.
Elina [12.6K]

Answer:

False

Explanation:

DSL(Digital Subscriber Line) :-It is a technology in which user gets high bandwidth connection over ordinary telephone lines.

This technique uses data modulation to achieve higher throughput over the telephone lines.Telephone lines carry voice signals over a small range of frequencies between 300 and 3300 Hz. So the frequencies that are higher are unused and available for data transfer.

DSL connection uses a modulation technique based on amplitude or phase modulation. With the help of modulation techniques DSL uses these unused higher frequencies.It uses frequency range higher than 300 to 3300 hz.

5 0
4 years ago
Select the correct answer. Why is it important to identify your audience while making a presentation? A. It helps you define the
Naddika [18.5K]

Answer:B

Explanation:

7 0
3 years ago
Read 2 more answers
Other questions:
  • 14. Which commercial RDBMS product was the first to hit the market and is the biggest?
    15·1 answer
  • Which type of network topology connects multiple devices to a central device?
    7·1 answer
  • Match the parts of a CPU to their fuctions
    8·1 answer
  • The order of precedence determine
    10·1 answer
  • QuickBooks Online (QBCU) Session 4: Post Assessme
    12·1 answer
  • Which module is missing from most expert systems? a. Knowledge base subsystem b. Inference engine c. User interface subsystem d.
    5·1 answer
  • Which part of project management involves determining the required materials?
    7·2 answers
  • The meaning of docile can be determined by the... context clue. synonym atonym or explanation
    14·2 answers
  • What is the depth of the following tree?
    10·1 answer
  • Animations<br> Animations are !<br> Blank which can be Applied to blank in a presentation?
    7·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!