Given that a function receives three parameters a , b , c , of type double , write some code, to be included as part of the function, that determines whether the value of “b squared” – 4ac is negative. If negative, the code prints out the message “no real solutions” and returns from the function.

1
Given that a function receives three parameters a , b , c , of type double , write some code, to be included as part of the function, that determines whether the value of “b squared” – 4ac is negative. If negative, the code prints out the message “no real solutions” and returns from the function.

LANGUAGE: C++

CHALLENGE:

Given that a function receives three parameters a , b , c , of type double , write some code, to be included as part of the function, that determines whether the value of “b squared” – 4ac is negative. If negative, the code prints out the message “no real solutions” and returns from the function.

SOLUTION:


if (b*b < 4*a*c){ cout << "no real solutions"; }

One comment

Add comment