// Include files
#include <iostream>  // used for cin, cout
#include <conio.h>
using namespace std;
// Global Type Declarations
// Function Prototypes
void instruct (void);
void pause ();
//Global Variables - should not be used without good reason.
int main ()
{
	 // Declaration section
	  double num1, num2, sum, product, quotient; 
	 // Executable section
	 instruct ();
   cout << "Enter first number: ";  
   cin >> num1;                  
   cout << "Enter second number: "; 
   cin >> num2;                  
   sum = num1 + num2;
   product = num1 * num2;
   quotient = num1 / num2;
   cout << "\nThe sum of " << num1 << " and " << num2 << " is " 
	   << sum 
	   << "\nThe product of " << num1 << " multiplied by " << num2 << " is " 
	   << product 
	   << "\nThe quotient of " << num1 << " divided by " << num2 << " is " 
	   << quotient << endl;
   cout << "\nThe difference of the two numbers is as follows: " 
	   << endl;
   if ( num1 == num2 )
	   cout << num1 << " is equal to " << num2 << endl;
   if ( num1 != num2 ) 
	   cout << num1 << " is not equal to " << num2 << endl;
   if ( num1 < num2 )
	   cout << num1 << " is less than " << num2 << endl;
   if ( num1 > num2 )
	   cout << num1 << " is greater than " << num2 << endl;
   if ( num1 <= num2 )
	   cout << num1 << " is less than or equal to " 
	   << num2 << endl;
   if ( num1 >= num2 )
	   cout << num1 << " is greater than or equal to "
	   << num2 << endl;
    pause ();
	return 0;
	 
}
void instruct (void)
{
	  // Declaration section
	  // Executable section
 cout << "Choose two whole numbers to input below. The program will\n"
	  << "then calculate the sum, the product, the difference, and the\n" 
	  << "quotient of the two numbers that have been input.\n "<< endl;
}
void pause ()
{
    // Declaration section
    // Executable section
    cout << "\nPress any key to continue...";
    getch();
    cout << "\r";
    cout << "                            ";
    cout << "\r";
}
/*
Program Output
Choose two whole numbers to input below. The program will
then calculate the sum, the product, the difference, and the
quotient of the two numbers that have been input.
Enter first number: 6
Enter second number: 4
The sum of 6 and 4 is 10
The product of 6 multiplied by 4 is 24
The quotient of 6 divided by 4 is 1.5
The difference of the two numbers is as follows:
6 is not equal to 4
6 is greater than 4
6 is greater than or equal to 4
Press any key to continue...
*/
			
		
 
	
Share This Thread