/* noglob2.cpp * CS401 - Intro to Comp Sci * * how global variables can screw you over * */ #include #include #include using namespace std; const double Pi = 3.14159; double cylinderVolume(); int main() { int r, h; cout << "this will compute cylindrical volume.\n\n"; cout << "enter radius: "; cin >> r; cout << "enter height: "; cin >> h; // input is in r and h, NOW WHAT??? the function is useless and // needs to be modified to work here - it was a poorly written // function to begin with, not modular at all cout << "the answer is " << cylinderVolume() << endl; } double cylinderVolume() { return (Pi * inp1 * inp1 * inp2); }