Problem type: Real life (calendar Problem)
#include<bits/stdc++.h>
using namespace std;
int main()
{
int day,date_no,x;
cout << "Enter any number of day (for example saturday = 1; sunday=2;monday =3 etc) that a month start" << endl;
cin >>day;
int next_day =7-day;
next_day = 1 + next_day;
cout << "Enter date to check which week :) " << endl;
while(cin >> x)
{
if(x==-1)
{
break;
}
if(x <= next_day)
{
cout <<"1st week" << endl;
}
else{
int cou =0;
int week_count=1;
for(int i=next_day+1;; i++)
{
cou++;
if(cou==8)
{
cou=1;
week_count++;
}
if(i==x)
break;
}
cout << week_count +1 <<" number week" << endl;
}
}
}