#include #include using namespace std; // function phototypes double computeMaxBendingMoment(double x, double w, double l); int main(int argc, char *argv[]) { // Parameter Declarations double x; // distance double w; // weight double l; // beam length double max_bending_moment; double max_bending_moment_half; // LOGO cout << "----------------------------------------------------------" << endl; cout << " CS135 Assignment 2: Bending Moment " << endl; cout << " By Chang Jia " << endl; cout << "----------------------------------------------------------" << endl; cout << endl; // Get Inputs cout << "Enter x (distance of w), w (weight), and l (beam length): "; cin >> x >> w >> l; // Print Outputs cout << "x = " << x << ", w = " << w << ", l = " << l << endl; //function call max_bending_moment = computeMaxBendingMoment( x, w, l); cout << "The maximum bending moment for distance " << x << " is: " << max_bending_moment << endl; //function call max_bending_moment_half = computeMaxBendingMoment( (x/2), w, l); cout << "The maximum bending moment for distance " << x/2 << " is: " << max_bending_moment_half << endl; cout << endl; system("PAUSE"); return EXIT_SUCCESS; } // Function Body double computeMaxBendingMoment(double distance, double weight, double length) { double moment; moment = distance*weight*((length - distance)/length); return moment; }