Soru
What should be typed to missing code sections in the following C++prc output properly? #include <iostream> /'missing code - I"/ int main() double x,y, is cout "Enter three numbers: cin >>x>>y >) 1; cout <<"The output is ' (c 41(x,y,z) << endl; return 0; , /missing code II" if (b (a) 88 ) return b; else if c (a) return c; else return a; ) I'missing code -II double flidouble a double b. couble C) b. I'missing code -1"double fl(couble, double double) I'musing code -11 double fil couble a double b double c) in missing code -17 couble fl couble, double double
Çözüm
4.1
(182 Oylar)
İlker
Gelişmiş · 1 yıl öğretmeni
Uzman doğrulaması
Cevap
To output properly, the missing code sections in the given C++ program should be filled as follows:```cpp#include double f(double a, double b, double c) { if (b > a) { return b; } else if (a > c) { return c; } else { return a; }}int main() { double x, y, z; cout > x >> y >> z; cout << "The output is " << f(x, y, z) << endl; return 0;}```Explanation:1. The function `f` takes three `double` parameters `a`, `b`, and `c`. It returns the largest of the three values.2. In the `main` function, the user is prompted to enter three numbers, which are stored in `x`, `y`, and `z`.3. The function `f` is called with `x`, `y`, and `z` as arguments, and the result is printed to the console.