1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57
|
#include<iostream>
#include<iomanip>
#include<fstream>
using namespace std;
int main()
{
int days[] = {31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31};
string month[] = {"January", "February", "March", "April", "May", "June", "July", "August", "September", "October", "November", "December"};
string todays[] = {"First", "Second", "Third", "Fourth", "Fifth", "Sixth", "Seventh", "Eighth", "Ninth", "Tenth", "Eleventh", "Twelveth", "Thirteenth", "Fourteenth", "Fifteenth", "Sixteenth", "Seventeenth\
", "Eighteenth", "Nineteenth", "Twentieth", "Twenty First", "Twenty Second", "Twenty Thirt", "Twenty Fourth", "Twenty Fifth", "Twenty Sixth", "Twenty Seventh", "Twenty Eighth", "Twenty Ninth", "Thirtieth", "\
Thiry First"};
int m;
int y;
int d;
cout << "Please enter a date starting with the month: " << endl;
cin >> m;
if(m < 1 || m > 12)
{
cout << "Invalid month entry!" << endl;
cout << "Enter valid month: " << endl;
cin >> m;
}
cout << "Please enter a date: " << endl;
cout << "Month: " << endl;
cin << m << endl;
cout << "Day: " << endl;
cin >> d; << endl;
cout << "Year: " << endl;
cin << y << endl;
if( (y%4) == 0 && (y!= 100) || (y%400) == 0)
days[1] = 29;
else
days[1] = 28;
if(y < 2000 || y > 2090)
cout << "Invalid year!" << endl; << "Please enter a valid year: " << endl;
//if(d <= days[d])
cout << month[m-1] << "," << todays[d-1] << y << endl;
system("pause");
}
|