View Single Post
Old 11-03-2003, 03:26 PM   #1 (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
need help with arrays

ok... i cant quite figure out what the problem is with this program....

[SHELL]
#include <iostream.h>
#include <stdlib.h>
#include <ctype.h>
long date[3];
int dateValid();
int monthState();


int main()
{
cout << "Please enter a date dd/mm/yyyy: ";
cin >> date[0] >> date[1] >> date [2];
dateValid();
cout << date[1];
monthState();
cout << date[2];
system("PAUSE");
return 0;
}

int dateValid()
{
for (int x=0; x<3; x++)
{
if (isdigit(date[x]))
cout << "Please enter a date dd/mm/yyyy: ";
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]

and whenever i complile it i get this beautiful little error
Quote:
initialization to `char' from `const char *' lacks a cast
12 times...

what the heck is going on?
CoW is offline   Reply With Quote