Server IP : 172.16.15.8 / Your IP : 3.144.90.236 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/kebuck/ |
[ Home ] | [ C0mmand ] | [ Upload File ] |
---|
// CS112 Computer Programming Assignment 3 // // File: hw3.cpp // Author: Katie Buck // Instructor: Dr. Wang // // Compile: g++ hw3.cpp // Run: ./a.out // // Goal: The goal is to write a program that will read two real // numbers, perform addition, subtraction, multiplication, and // division operations, and then ouput the results to one decimal // place. #include <iostream> #include <iomanip> using namespace std; int main() { cout << fixed << showpoint << setprecision(1); float num1, num2, addition, subtraction, multiplication, division; cout << "Input two real numbers. "; cin >> num1 >> num2; addition = num1 + num2; subtraction = num1 - num2; multiplication = num1 * num2; division = num1 / num2; cout << " The sum of the two numbers are " << addition << endl; cout << " The difference of the numbers are " << subtraction << endl; cout << " The product of the two numbers are " << multiplication << endl; cout << " The division of the two numbers are " << division << endl; return 0; }