answer.
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
kirill115 [55]
2 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.
Computers and Technology
1 answer:
VMariaS [17]2 years ago
5 0

Answer:

#include <iostream>

#include <cmath>

using namespace std;

//initialize function quadratic

void quadratic(double, double, double);

int main() {

   //declare double variables a, b and c

   double a,b,c;

   //take input from user

   cin>>a>>b>>c;

   //call function quadratic

   quadratic(a,b,c);

return 0;

}

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

   double root,n;

   //check if variable a is equal to zero

   if(a==0){

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

       return;

   }

   //check if b squared - 4ac is less than zero

   else

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

       cout<<"no real solutions"<<endl;

       return;

   }

   //print the largest root if the above conditions are not satisfied

   else{

       n=((b*b)-(4*a*c));

       root=(-b + sqrt(n)) / (2*a);

       cout<<"Largest root is:"<<root<<endl;

   }

   return ;

}

Explanation:

Read three double variables a, b and c from the user and pass it to the function quadratic. Check if the value of variable a is equal to zero. If true, print "no solution for a=0". If this condition is false, check if b squared - 4ac is less than zero. If true, print "no real solutions". If this condition is also false, calculate the largest solution using the following formula:

largest root = (-b + square root of (b squared - 4ac)) / (2*a)

Input 1:

2 5 3

Output 2:

Largest root is:-1

Input 2:

5 6 1

Output 2:

Largest root is:-0.2

You might be interested in
Dr. Robbins wants to know if there are different opinions regarding the value of public school education between Native American
zmey [24]

Answer:

The independent variable is Native American participants

Explanation:

Why Native Americans is the independent variable is bacause the survey population is Native Americans and the result of the survey won't be affected by the gender and age of the native american participants. So it the independent variable.

5 0
2 years ago
Wesley has to create a web banner to announce a “Back to School” sale by an online retailer. Which information should he determi
olganol [36]
I would say A :)))))))
4 0
2 years ago
Read 2 more answers
_____ remove the part of an image starting from an edge​
Lapatulllka [165]
I think it’s cropping could be wrong though
4 0
2 years ago
Do all of the packets in your sent messages always follow the same path? If not, describe at least two different paths packets t
Lemur [1.5K]

Answer:

All the message I sent were from the same routers

Explanation:

All the message I sent were from the same routers

5 0
2 years ago
Read 2 more answers
Write a python 3 function named words_in_both that takes two strings as parameters and returns a set of only those words that ap
s344n2d4d5 [400]

Answer:

def words_in_both(a, b):

 a1 = set(a.lower().split())

 b1 = set(b.lower().split())

 return a1.intersection(b1)

common_words = words_in_both("She is a jack of all trades", 'Jack was tallest of all')

print(common_words)

Explanation:

Output:

{'all', 'of', 'jack'}

5 0
2 years ago
Read 2 more answers
Other questions:
  • In which of these places might you be most likely to find a peer-to-peer network? On the Internet In a hospital In a home In a l
    5·2 answers
  • For drivers under 21, the penalties for driving with an illegal BAL include _____.
    5·2 answers
  • When a program has several modules calling other modules, programmers often use a program ____, which operates similarly to an o
    5·1 answer
  • You need to design a data storage scheme for Hayseed Heaven library data system. There are several hundred thousand large data r
    8·1 answer
  • Assume you have a variable, budget, that is associated with a positive integer. Assume you have another variable, shopping_list,
    11·1 answer
  • What is an input to the Program Increment Planning process that highlights how Product Management plans to accomplish the Vision
    15·1 answer
  • Given input characters for an arrowhead and arrow body, print a right-facing arrow. Ex: If the input is: *
    14·1 answer
  • On a webpage, a _____ provides supplemental material such as social networking feeds and ads. Group of answer choices footer sid
    9·1 answer
  • For a data structure, such as a stack, who is responsible for throwing an exception if the stack is empty and a pop() is called:
    13·1 answer
  • Accenture has partnered with a global construction company that specializes in building skyscrapers. The company wants better ma
    12·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!