//=========================================================
// File: HW_10a
// Programmer: Elaine Torrez
// Class: CMPR 121
//=========================================================
// Description:
// This program uses the max template function.
// It returns the greater of two values.
//=========================================================
#include <iostream>
#include <algorithm>
#include <string>
using namespace std;
int main()
{
int firstNumber;
int secondNumber;
char firstLetter;
char secondLetter;
double firstDecimal;
double secondDecimal;
string firstWord;
string secondWord;
firstNumber = 1;
secondNumber = 2;
firstLetter = 'a';
secondLetter = 'z';
firstDecimal = 3.14;
secondDecimal = 2.72;
firstWord = "apple";
secondWord = "zebra";
cout << "The greater value of "
<< firstNumber << " and "
<< secondNumber << " = "
<< max(firstNumber, secondNumber)
<< endl;
cout << "The greater value of "
<< secondNumber << " and "
<< firstNumber << " = "
<< max(secondNumber, firstNumber)
<< endl;
cout << "The greater value of '"
<< firstLetter << "' and '"
<< secondLetter << "' = "
<< max(firstLetter, secondLetter)
<< endl;
cout << "The greater value of "
<< firstDecimal << " and "
<< secondDecimal << " = "
<< max(firstDecimal, secondDecimal)
<< endl;
cout << endl;
cout << "Does the max function work with strings? Yes."
<< endl;
cout << "Strings can be compared alphabetically,"
<< " so max() works with string data types."
<< endl;
cout << "Example: "
<< max(firstWord, secondWord)
<< " is greater alphabetically."
<< endl;
return 0;
}