// ;----------------------------------------------------------- // ; Program Name: Class_Demo // ; File: y_mxb.cpp // ; Description: Performs some calculations using slope intercept math form // ; Author: Jim Adams // ; Assignment: None // ; Environment: MS C++ 6.0 // ; Revisions: 09/24/2000 Original version // ; // ;----------------------------------------------------------- #include #include // Function Prototypes void get_input(float& m, float& x, float& b); float slope_intercept(float m, float x, float b); void display_results(float y, float m, float x, float b); // Variable definitions float x=0; float y=0; float b=0; float m=0; void main() { get_input(m, x, b); y = slope_intercept(m, x, b); display_results(y, m, x, b); } void get_input(float& m, float& x, float& b) { cout << "Enter slope(m):"; cin >> m; cout << "Enter x:"; cin >> x; cout << "Enter b:"; cin >> b; } float slope_intercept(float m, float x, float b) { float y=0.0; y = m*x + b; return(y); } void display_results(float y, float m, float x, float b) { cout << endl; cout << "The result of \"y=mx + b\" is:" << y << endl; cout << "Where m=" << m << endl; cout << " x=" << x << endl; cout << " b=" << b << endl; cout << endl; }