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
kirill115 [55]
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.
Computers and Technology
1 answer:
VMariaS [17]4 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
Nancy needs to find the average of two numbers in the middle from an even count of numbers arranged in descending order. which s
Rus_ich [418]

i would say e. the median

7 0
3 years ago
Read 2 more answers
I bought an iPhone 6s Plus with 16gb three days ago and I found out that it s very little space for my liking and I want to exch
Mashutka [201]
You can return it for a refund, however with that money you will need to pay the difference, as they are different models and the 64gb will cost more.
3 0
3 years ago
How does join work? a. You write separator.join('a', 'b', 'c', 'd', ...) where 'a', 'b', 'c', 'd' can be replaced with other str
Ulleksa [173]

Answer:

c. You use separator.join(a_list) where a_list is a list of strings.

Explanation:

The join() is an in-built string method which returns a string concatenated with the elements of an iterable. It concatenates each element of an iterable (such as list, string and tuple) to the string and returns the concatenated string.

The syntax of join() is:

string.join(iterable)

From the above syntax, the string usually mean a separator and the iterable will be a string or list or tuple.

The answer is C.

c. You use separator.join(a_list) where a_list is a list of strings.

It is not A because the iterable could be a string. It is not D because the separator is outside not in the bracket.

6 0
3 years ago
Which spreadsheet feature could the scholarship committee use to locate applicants who meet the criteria?
Radda [10]

Answer:

H8

Explanation:

4 0
3 years ago
Multiple Intelligence Theory explains that...
Alex

Answer:

A. We all learn differently (edge 2020)

Explanation:

4 0
3 years ago
Read 2 more answers
Other questions:
  • Amanda needs to create an informative print brochure for her local library’s fundraiser dinner. What critical detail must she ha
    14·2 answers
  • Explain what a honeypot is. In your explanation, give at least one advantage and one disadvantage of deploying a honeypot on a c
    12·1 answer
  • I play Among us :) hbu
    7·2 answers
  • a password to a certain database consists of digits that cannot be repeated. if the password is known to consist of at least 8 d
    14·1 answer
  • When an attacker presents a program or himself as someone else to obtain private information and pretends to be a legitimate web
    11·1 answer
  • Write a program that lets the user play the game of Rock, Paper, Scissors against the computer. The program should work as follo
    15·1 answer
  • A __________ search engine focuses on a specific subject.<br><br>answer : Specialized
    8·1 answer
  • In this project you will write a set of instructions (algorithm). The two grids below have colored boxes in different
    9·2 answers
  • Provide examples of how information technology has created an ethical dilemma that would not have existed before the advent of I
    7·1 answer
  • Which of the statements below are true? Which are false?
    14·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!