//Maxwell Brewer CS1A Chapter 4, P. 220, #1
//
/***************************************************************
*
* OUTPUT MINIMUM MAXIMUM
* _____________________________________________________________
*
* This program will use the if then else
* statement to determine the larger of
* two numbers.
* _____________________________________________
* INPUT
*
* a, b
*
* OUTPUT
*
* a, b
*
***************************************************************/
#include <iostream>
#include <iomanip>
#include <cmath>
#include <string>
using namespace std;
int main() {
// Initialization
const char MSG_1[] = "Enter the 1st number: \n";
const char MSG_2[] = "Enter the 2nd number: \n";
const char MSG_3[] = "The larger number is: \n";
const char MSG_4[] = "The smaller number is: \n";
const char MSG_5[] = "Both numbers are equal.";
int a;
int b;
// Display input prompts
cout << MSG_1;
cin >> a;
cout << MSG_2;
cin >> b;
// Output
if (a > b)
{
cout << MSG_3 << a << endl;
cout << MSG_4 << b << endl;
}
else if (b > a)
{
cout << MSG_3 << b << endl;
cout << MSG_4 << a << endl;
}
else
{
cout << MSG_5 << endl;
}
return 0;
}
Ly9NYXh3ZWxsIEJyZXdlciAgICAgICAgICAgIENTMUEgICAgICAgICAgIENoYXB0ZXIgNCwgUC4gMjIwLCAjMQovLwovKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqCiAqIAogKiBPVVRQVVQgTUlOSU1VTSBNQVhJTVVNCiAqIF9fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX18KICogCiAqIFRoaXMgcHJvZ3JhbSB3aWxsIHVzZSB0aGUgaWYgdGhlbiBlbHNlCiAqIHN0YXRlbWVudCB0byBkZXRlcm1pbmUgdGhlIGxhcmdlciBvZgogKiB0d28gbnVtYmVycy4KICogX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fCiAqIElOUFVUCiAqIAogKiBhLCBiCiAqIAogKiBPVVRQVVQKICogCiAqIGEsIGIKICogCiAqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqK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