Server IP : 172.16.15.8 / Your IP : 18.116.15.22 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) : /home/wakeating/ |
[ Home ] | [ C0mmand ] | [ Upload File ] |
---|
// File name: assignment3.cpp // Author: Whitney Keating // Instructor: Dr. John Wang // Due date: Wed., Sept. 19, 2007 // Compilation: g++ assignment3.cpp -o assignment3.out // Execution: ./assignment3.out // // Goal: This program will output the operations of two numbers #include <iostream> #include <iomanip> using namespace std; int main() { // 1. declare variables float a, b, add, sub, mul, div; cout << fixed << showpoint << setprecision(1); // 2. input cout << "Input a: (-1 to quit): "; cin >> a; cout << "Input b: "; cin >> b; while( a > 0) { // 3. computing add = a + b; sub = a - b; mul = a * b; div = a / b; // 4. output cout << setprecision(1); cout << a << "\t+\t" << b << "\t=\t" << add << "\n"; cout << a << "\t-\t" << b << "\t=\t" << sub << "\n"; cout << a << "\t*\t" << b << "\t=\t" << mul << "\n"; cout << a << "\t/\t" << b << "\t=\t" << div << "\n"; cout << "Input a: (-1 to quit): "; cin >> a; cout << "Input b: "; cin >> b; } return 0; }