Check input data via bool function

I'm having a hard time coming up with a way to check to see if values gathered from cin days (1-31) and months (1-12) can be checked via a bool function.

Here's a snippet of my code..

#include <iostream>

using namespace std;

void PrintTitle();
void GetDate(int&, int&, int&);
bool ValidDate(int, int, int);
int DaysInMonth(int);
int ZellersNumber(int, int, int);
void DayToString(int);

int main()
{

int month, day, year;
int x;
PrintTitle();
GetDate(month, day, year);
x = ZellersNumber(month, day, year);
DayToString(x);

return 0;
}

void PrintTitle()
{

cout << "Zeller's Number Algorithm" << endl;

}
void GetDate(int& M, int& D, int& Y)
{
cout << endl << "Enter the Month: ";
cin >> M;
cout << "Enter the Day: ";
cin >> D;
cout << "Enter the Year: ";
cin >> Y;
}

bool ValidDate(int M, int D, int Y)
{

if (! (1<= M && M<=12))
return false;

}

It obviously needs more work, but any help is appreciated.
I think (! (1<= M && M<=12)) you would make it complicated
I am not sure but this would be better
1
2
3
4
5
6
 if (M < 1 && M > 12)
return false;

or 
if (! (M > 1 && M < 12))
return false;


this is my assumption.
Topic archived. No new replies allowed.