请问这道题如何改正
//3-8程序模板,请在此基础上修改并完善代码,使其具有完善的功能。#include <iostream>
using namespace std;
#include <ctime>
#include <cstdlib>
enum Months{JAN=1,FEB,MAR,APR,MAY,JUN,JUL,AUG,SEP,OCT,NOV,DEC};
void printDate(Months,int,int);
int validDate(int,int);
int main()
{
int month=1,day=1,year=1900;
srand(time(0));
printDate(month,day,year);
year=getYear(year);
getMonth();
day=getDay();
if(validDate(month,day,year)==true)
printDate(month,day,year);
return 0;
}
int getMonth()
{
Months myMonth=rand()%12+1;
return myMonth;
}
int getYear(int aYear)
{
return rand()%101+1900;
}
void getDay(){return rand()%31+1;}
void printDate(Months month,int day,int year)
{ //改正并完成下面函数
switch(month)
{
case JAN:cout<<"January "<<day<<","<<year<<endl;
case FEB:cout<<"February "<<day<<","<<year<<endl;
//完成其他情况
default:cout<<"invalid month\n";
}
}
bool validDate(int month,int day,int year)
{
int month,day,year;
if(year<1900||year>2001)
return false;
else if(month<1||month>12)
return false;
else if(day<1||day>31)
return false;
else if(day==31&&(month==APR||month==JUN||month==SEP||month==NOV))
return false;
else if(month==2&&day>28)
return false;
}