(Find the Minimum) Write a program that inputs three double-precision, floating-point numbers and passes them to a function that returns the smallest number.
Solution:
Solution:
#include <iostream> using std::cout; using std::cin; double smallest(double, double, double); int main() { double i, j, k; cout << "Enter three floating point numbers: "; cin >> i >> j >> k; cout << "The smallest is " << smallest(i, j, k); return 0; } double smallest(double i, double j, double k) { double smal; smal = i; if( i > j) { if( j > k) smal = k; else smal = j; } else { if( i > k) smal = k; } return smal; }
Post A Comment:
0 comments: