#include <iostream> #include<cmath> #include<ctime> #include<string> #include <iomanip> #include <fstream> using namespace std; int main() { cout << "enter the month "; int month; cin >> month; cout << "Enter The First Day Of The Month "; int firstDay; cin >> firstDay; int nextSunday = 1; switch (firstDay) { case 1: nextSunday += 7; cout << "The first day of this month is sunday "<<endl; while (nextSunday < 30) { cout << "Next Sunday of this month is on " << nextSunday << endl; nextSunday += 7 ; } break; case 2: nextSunday += 6; cout << "The first day of this month is monday " << endl; while (nextSunday < 30) { cout << "Next Sunday of this month is on " << nextSunday << endl; nextSunday += 7; } break; case 3: nextSunday += 5; cout << "The first day of this month is tuesday " << endl; while (nextSunday < 30) { cout << "Next Sunday of this month is on " << nextSunday << endl; nextSunday += 7; } break; case 4: nextSunday += 4; cout << "The first day of this month is wednesday " << endl; while (nextSunday < 30) { cout << "Next Sunday of this month is on " << nextSunday << endl; nextSunday += 7; } break; case 5: nextSunday += 3; cout << "The first dayof this month is thursday " << endl; while (nextSunday < 30) { cout << "Next Sunday of this month is on " << nextSunday << endl; nextSunday += 7; } break; case 6: nextSunday += 2; cout << "The first day of this month is friday " << endl; while (nextSunday < 30) { cout << "Next Sunday of this month is on " << nextSunday << endl; nextSunday += 7; } break; case 7: nextSunday += 1; cout << "The first day of this month is saturday " << endl; while (nextSunday < 30) { cout << "Next Sunday of this month is on " << nextSunday << endl; nextSunday += 7; } break; } }