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 58 59
|
#include<iostream>
#include<iomanip>
#include<fstream>
#include<string>
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 Third", "Twenty Fourth", "Twenty Fifth", "Twenty Sixth", "Twenty Seventh", "Twenty Eighth", "Twenty Ninth", "Thirtieth", "Thiry First"};
string todays2[] = {"Twenty", "Thirty", "Fourty", "Fifty", "Sixty", "Seventy", "Eighty", "Ninety"};
string single[] = {"One", "Two", "Three", "Four", "Five", "Six", "Seven", "Eight", "Nine" "Ten", "Eleven" "Twelve", "Thirteen", "Fourteen", "Fifteen", "Sixteen", "Seventeen", "Eighteen", "Nineteen"};
int m;
int y;
int d;
cout << "Please enter a date: " << endl;
cout << "Month: " << endl;
cin >> m;
cout << "Day: " << endl;
cin >> d;
cout << "Year: " << endl;
cin >> y;
if( (y%4) == 0 && (y!= 100) || (y%400) == 0)
days[1] = 29;
else
days[1] = 28;
// cout << days[1] << endl;
// system ("pause");
if(y < 2000 || y > 2090)
{
cout << "Invalid year!";
cout << "Please enter a valid year: " << endl;
cin >> y;
}
if(m < 1 || m > 12)
{
cout << "Invalid month entry!" << endl;
cout << "Enter valid month: " << endl;
cin >> m;
}
//if(d <= days[d])
int x =0;
string a;
x = y - 2000;
if(x < 20)
a = single[x-3];
cout << month[m-1] << ", " << todays[d-1] << ", " << "Two Thousand and "+ a << endl;
system("pause");
}
|