#include <iostream> #include<cmath> #include<ctime> #include<string> #include <iomanip> #include <fstream> using namespace std; int main() { cout << "enter the year "; int year; cin >> year; cout << "Enter The First Day Of The year "; int FirstDay; cin >> FirstDay; int count = 1; int days = 1; for (int month = 1; month <= 12; month++) { cout << " "; switch (month) { case 1: cout << "January " << year<<endl; break; case 2: cout << "February " << year << endl; break; case 3: cout << "March " << year << endl; break; case 4: cout << "April " << year << endl; break; case 5: cout << "May " << year << endl; break; case 6: cout << "June " << year << endl; break; case 7: cout << "July " << year << endl; break; case 8: cout << "August " << year << endl; break; case 9: cout << "September " << year << endl; break; case 10: cout << "October " << year << endl; break; case 11: cout << "November " << year << endl; break; case 12: cout << "December " << year << endl; break; } cout << " --------------------------------------------------------- "<<endl; cout << " Sun Mon Tue Wed Thu Fri Sat"<<endl; for (int i = 0; i < FirstDay; i++) { cout << " "; } for (int i = 1; i < 31; i++) { if (i < 10) { cout<<" " <<i; } else { cout<<" " << i; } if ((i + FirstDay) % 7 == 0) { cout << endl; } } cout << endl; FirstDay = (FirstDay + 31) % 7; } }
Preview:
downloadDownload PNG
downloadDownload JPEG
downloadDownload SVG
Tip: You can change the style, width & colours of the snippet with the inspect tool before clicking Download!
Click to optimize width for Twitter