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
When you write a check, why do you always begin writing the amount of the check as far to the left as you can?
Ivenika [448]

Answer:

You start at the left without leaving any paces so no one can add any more numbers.

Explanation:

5 0
3 years ago
According to Gitlin, during the 1950s and 60s television production costs began to exceed the licensing fees the networks paid i
wlad13 [49]

Answer:

syndication

Explanation:

According to Gitlin, during the 1950s and 60s television production costs began to exceed the licensing fees the networks paid in order to broadcast their programming. But the studios could make that money back by putting a show in syndication after it produced 100 episodes that could be programmed in re-runs. Syndication is the licensing or sale of a publication material by television stations.

5 0
3 years ago
(a) If host 192.168.0.1 sends out a packet with source IP address 192.168.0.1 and source port number 3345, after the packets lea
Evgen [1.6K]

Question: The question is incomplete. See the complete question below;

Consider the following situation using NAT (Network Address Translation), where the router uses one public IP address, 138.76.29.7, for several hosts with private IP addresses. The NAT table already has the information as shown due to previous communications.

Answer:

Source IP = 208.38.69.1

Source port = 3006

Explanation:

Network Address Translation (NAT) simply means  the translation of one or more local IP address so as to provide internet access to local hosts. In this case, the router uses one public IP address and with private IP address.

8 0
3 years ago
Intellectual property does not include which of the following
liq [111]
I'd have to say C. the steel as this is very physical as the others aren't as much which makes it stand out 
8 0
3 years ago
Why might you add the Outer Glow effect to text?
-Dominant- [34]

Answer:

nothing it's perfect in the way it is

Explanation:

4 0
2 years ago
Other questions:
  • Respond to the following in three to five sentences. Select the workplace skill, habit, or attitude described in this chapter (a
    12·1 answer
  • Americans overwhelmingly support organ and tissue donation.
    5·1 answer
  • The rod and crankshaft convert the up-and-down motion of the piston into
    5·2 answers
  • The steps for moving data from one cell to another are _____.
    14·1 answer
  • A new product was introduced in 2003, which functions as both an identification device and a medium of communication. It uses in
    8·1 answer
  • How does human error relate to security risks
    5·1 answer
  • Java can be used to create which of the following technologies?This task contains the radio buttons and checkboxes for options.
    5·1 answer
  • In which case will the linear search return the lowest value faster than the<br> binary search?
    13·1 answer
  • Which statement best describes the difference between a spreadsheet and a database?
    9·2 answers
  • A palindrome is a string that reads the same from left to right and from right to left. Design an algorithm to find the minimum
    15·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!