// Mr. Minich
// CMPSC 201
// Ch. 6 Demo Program #4 // July 21, 2000 // Purpose - to illustrate the use of functions
#include <iostream> #include <string> #include <math.h> using namespace std; double discriminant(double , double , double ); void printMyName(string myName); int main() { double a = 0.0; double b = 0.0; double c = 0.0; cout << "Enter a: "; cin >> a; cout << "Enter b: "; cin >> b; cout << "Enter c: "; cin >> c; printMyName("Mr. Minich"); cout << endl << "The discriminant is " << discriminant(a, b, c) << endl; return 0; }// end of main double discriminant(double myA, double myB, double myC) { double result = 0.0; result = pow(myB, 2) - 4 * myA * myC; return result; }// end of discriminant void printMyName(string myName) { cout << myName << endl; }// end of printMyName