View Single Post
Old 11-04-2003, 06:42 AM   #11 (permalink)
CoW
Registered User
 
CoW's Avatar
 
Join Date: May 2003
Location: Paris, France
Posts: 31
CoW is on a distinguished road
Send a message via AIM to CoW
thanks for the help guys, i dicided to drop the isdigit thing all together as it only works for values 1 thru 9...

heres the finished (working!) code.
[SHELL]
#include <iostream.h>
#include <stdlib.h>
#include <ctype.h>

int date[3];
int dateValid();
int monthState();

int main()
{

cout << "Please enter a date dd/mm/yyyy: ";
cin >> date[0];
cin >> date[1];
cin >> date[2];
dateValid();
cout << date[1] << " ";
monthState();
cout << date[2];

system("PAUSE");
return 0;
}


int dateValid()
{

if (date[0] > 31 || date[0] < 1)
cout << "Invalid Entry\n";
else
cout << "Entry Valid\n";

if (date[1] > 12 || date[1] < 1)
cout << "Invalid Entry\n";
else
cout << "Entry Valid\n";

if (date[2] > 2020 || date[2] < 1990)
cout << "Invalid Entry\n";
else
cout << "Entry Valid\n";
};


int monthState()
{
int x= date[0];
char *month[12] = {"January", "February", "March",
"April", "May", "June",
"July", "August", "September",
"October", "November", "December"};

cout << month[x] << " ";
};
[/SHELL]
CoW is offline   Reply With Quote