Q:

Need advice for input validation

I have finished a very simple assignment for my class.  However I am the type of person that likes to think outside the box. 
For Example, user_input1 and user_input2 has no type of validation to it.  I could type "November" and it would not catch the bad data type error.  My question to every one is, what way is the best way to approach input validation for the initial user inputs
// This program uses a function template.
   #include <iostream>
   #include <iomanip>
   #include <string>
   using namespace std;

// Template definition for square function.
   template <class T>
   T maximum (T number1 , T number2)
   {
     if ( number1 > number2)
     return number1;     
     else    
     return number2;
   }

   template <class S> 
   S minimum (S number1 , S number2)
   {
     if ( number1 > number2) 
     return number2;     
     else    
     return number1;
    }

 int main()
 {
 double user_input1 = 0; // To hold integer input
 double user_input2 = 0;
 int menu_choice = 0;

 cout << " Please Enter The First Number To Be Evaluated ";
 cin >> user_input1;

 cout << " Please Enter The Second Number To Be Evaluated ";
 cin >> user_input2;

 system ("cls");

 cout << " Your Entry Was As Followed   1: " << user_input1 << "  2: " <<user_input2;

 cout << "\n 1.   This Option Will Show You The Greater Argument ";

 cout << "\n 2.   This Will Show You The Lesser Argument ";

 cout << "\n  Your Menu Choice Is ";
 cin >> menu_choice;

 switch ( menu_choice )
 {
 case 1:
     cout << maximum (user_input1 , user_input2);
     break;
 case 2:
     cout << minimum (user_input1 , user_input2);
     break;
 defualt : 
     " INVALID ENTRY ";
 }
 system ("pause");
 return 0;
} 

A:

You may parse user's input and check it for correctness.
When you feed "November" into user_input1 you probably initialize this number by integer address of first element of this array (correct me here). Then it will be implicitly converted into double from int (probably).
Implement bool is_number(std::string const& input) function to validate only numbers in user's input in this code. You may do this in following way (for example):
#include <assert.h>
#include <iostream>
// ... //
int main() {

  string input;

  cout << " Please Enter The First Number To Be Evaluated ";
  cin >> input;
  assert(is_number(input));
  double user_input1 = stod(input);

  cout << " Please Enter The Second Number To Be Evaluated ";
  cin >> input;
  assert(is_number(input));
  double user_input2 = stod(input);
  // ... //
}

In general, assert is used for debugging purposes.
You may use if-else statement instead and write error message when user's input is incorrect. I'v write example above because of it's shortness.

