/* A solution to COM1100 Quiz #3 (code RXcd) * by Professor Futrelle, 10/22/2000 */ #include <iostream> using namespace std; // function prototypes; adding parameter names not necessary void doComps(float divis, float ADDEND, float mult); void printResult(int result); int main() { const float ADDEND = 4.0e1; float mult, divis; cout << "\nFor computing (20/divisor + addend) * multiplier\n" << "please enter the divisor and multiplier: "; cin >> divis >> mult; doComps(divis, ADDEND, mult); return 0; } // function definitions void doComps(float divis, float ADDEND, float mult) { int intResult; intResult = (20/divis + ADDEND) * mult; printResult(intResult); } void printResult(int result) { cout << "\nThe integer value of the result is: " << result << "\n\n"; } /* Trace of program output and input: For computing (20/divisor + addend) * multiplier please enter the divisor and multiplier: 2.0 3.0 The integer value of the result is: 150 */