Hello!!
I am working on a program in which you input three integers and then asks to checkif they are valid dates. I have been working on this code for a while and I cant seem to figure out what i am doing wrong. I'm trying to learn as best I can. If anyone could please look at my code and help me figure out what i am doing wrong. i keep getting this error message saying daysInMonthIs31' : undeclared identifier. I know I am still missing some stuff but i cant figure out what and where. So i would really apprecite any help i can get. thank you.
#include<iostream>
#include<string>
using namespace std;
const int MINIMUM_MONTH_IN_YEAR = 1;
const int MAXIMUM_MONTH_IN_YEAR = 12;
int main(void)
{
// 1. Input
cout << "Enter a date as three numbers separated by spaces <month, day, year>: ";
int month;
int day;
int year;
cin >> month >> day >> year;
cin.ignore(99, '\n');
if ( month < MINIMUM_MONTH_IN_YEAR || month > MAXIMUM_MONTH_IN_YEAR )
{
cout << endl << "This is not a valid date.";
cin.ignore(99,'\n');
return 1;
}
// Process
// Determine if its a leap year.
if (month == 2 && day == 29 && (year%4 == 0) && ((year%100 !=0) || (year% 400 == 0)))
if ( month == 4 && day <= 30)
if ( month == 6 && day <= 30)
if ( month == 9 && day <= 30)
if ( month == 11 && day <= 30)
if ( month == 1 && day <= 31)
if ( month == 3 && day <= 31)
if ( month == 5 && day <= 31)
if ( month == 7 && day <= 31)
if ( month == 8 && day <= 31)
if ( month == 10 && day <= 31)
if ( month == 12 && day <= 31)
string validDates;
if ( daysInMonthIs31) validDates = "This is a valid date";
else if ( daysInMonthIs30 ) validDates = "This is a valid date";
else if (daysInFeb28) validDates = "This is a valid date";
else if (ifLeapYear) validDates = "This is not a valid date";
else validDates = "This is not a valid date";
// output
cout << validDates << endl;
// Shutdown
// Pause/hold the screen
cout << endl;
cout << "Press ENTER to finish...";
cin.ignore(99,'\n');