// Would someone please help me figure out how to get C++ to accept my inputed month value as a decimal, by in-turn change it to an integer?
#include <iostream>
using namespace std;
int main()
{
int month, day, year;
cout << "Enter a month (use 1 for january, ect.): ";
cin >> month;
cout << "Enter a day of the month: ";
cin >> day;
cout << month << "/" << day << endl;
if ( day == (int) day )
{ // Day must be an integer quantity.
}
else
{
cout << "day is invalid" << endl;
}
if ( (month < 1 ) || ( month > 12) )
{
cout << "Month value is invalid." << endl;
}
if ( (day < 1 ) || ( day > 31) )
{
cout << "Day value is invalid." << endl;
}
switch (month)
{
case 9: // September
case 4: // April
case 6: // June
case 11: // November
{
if ( day > 30 )
{
cout << "Day value is invalid." << endl;
}
}
break;
case 2: // February
{
if ( day > 28 )
{
cout << "Day value is invalid." << endl;
}
}
break;
}
return 0;
}