Problem: Write a C++ program to take two inputs from the user, the year N, and d, the day of the week that January 1st falls on. Assume that the days are encoded as follows: (Mon: 1, Tues: 2, Wed: 3,   Sun: 7). Based on this, print all the dates on which Sunday falls on in that year.You must also take into account if the year is a leap year or not. The year is said to be a leap year if the year is divisible by four, except for end-of-century years where the year should be divisible by 400.

Example:Let s say you were interested in finding out all the dates when Sunday is going to be this year i.e. 2024, then the input to your code should be:2024 1Explanation for the above input: 2024 is the year and 1st Jan happened to be on Monday this year, hence was number-encoded as 1The output should list the dates of all Sundays in the year N, month-wise on a new line.

Constraints (Assume)1000 <= N (Year) <= 35001 <= d <= 12

Student submission:
#include<simplecpp>
main_program
{
int y,d,t;
cin>>y>>d;
t=d;
int d1=1;
if(y%4!=0)
{
 
  while(t<7)
	 { t=t+1;
	 d1=d1+1;}
//cout<<d1;
int k=d1;
cout<<"Month 1: ";
while(k<=31)
{	cout<<k<<" ";
k=k+7;}
cout<<endl<<"Month 2: ";
int d=0;
while(k!=31)
{	k=k-1;
	d=d+1;}
while(d<=28)
{       cout<<d<<" ";
d=d+7;}
int e=0;
while(d!=28)
{       d=d-1;
        e=e+1;}
cout<<endl<<"Month 3: ";
while(e<=31)
{       cout<<e<<" ";
e=e+7;}
int f=0;
while(e!=31)
{       e=e-1;
        f=f+1;}
cout<<endl<<"Month 4: ";
while(f<=30)
{       cout<<f<<" ";
f=f+7;}
int t=f;
int g=0;
while(t!=30)
{      t =t-1;
        g=g+1;}
cout<<endl<<"Month 5: ";
while(g<=31)
{       cout<<g<<" ";
g=g+7;}
t=g;
int cnt =0;

while(t!=31)
{       t=t-1;
        cnt=cnt+1;}
cout<<endl<<"Month 6: ";
while(cnt<=31)
{       cout<<cnt<<" ";
cnt=cnt+7;}
t=cnt;
 cnt =0;

while(t!=30)
{       t=t-1;
        cnt=cnt+1;}
cout<<endl<<"Month 7: ";
while(cnt<=31)
{       cout<<cnt<<" ";
cnt=cnt+7;}
t=cnt;
 cnt =0;

while(t!=31)
{       t=t-1;
        cnt=cnt+1;}
cout<<endl<<"Month 8: ";
while(cnt<=31)
{       cout<<cnt<<" ";
cnt=cnt+7;}
t=cnt;
 cnt =0;

while(t!=31)
{       t=t-1;
        cnt=cnt+1;}
cout<<endl<<"Month 9: ";
while(cnt<=30)
{       cout<<cnt<<" ";
cnt=cnt+7;}
t=cnt;
 cnt =0;

while(t!=30)
{       t=t-1;
        cnt=cnt+1;}
cout<<endl<<"Month 10: ";
while(cnt<=31)
{       cout<<cnt<<" ";
cnt=cnt+7;}
t=cnt;
 cnt =0;

while(t!=31)
{       t=t-1;
        cnt=cnt+1;}
cout<<endl<<"Month 11: ";
while(cnt<=30)
{       cout<<cnt<<" ";
cnt=cnt+7;}

t=cnt;
 cnt =0;

while(t!=30)
{       t=t-1;
        cnt=cnt+1;}
cout<<endl<<"Month 12: ";
while(cnt<=31)
{       cout<<cnt<<" ";
cnt=cnt+7;}



}
else
{
d1=1;	t=d;
//leap
while(t<7)
         { t=t+1;
         d1=d1+1;}
//cout<<d1;
int k=d1;
cout<<"Month 1: ";
while(k<=31)
{       cout<<k<<" ";
k=k+7;}
cout<<endl<<"Month 2: ";
int d=0;
while(k!=31)
{       k=k-1;
        d=d+1;}
while(d<=29)
{       cout<<d<<" ";
d=d+7;}
int e=0;
while(d!=29)
{       d=d-1;
        e=e+1;}
cout<<endl<<"Month 3: ";
while(e<=31)
{       cout<<e<<" ";
e=e+7;}
int f=0;
while(e!=31)
{       e=e-1;
        f=f+1;}
cout<<endl<<"Month 4: ";
while(f<=30)
{       cout<<f<<" ";
f=f+7;}
int t=f;
int g=0;
while(t!=30)
{      t =t-1;
        g=g+1;}
cout<<endl<<"Month 5: ";
while(g<=31)
{       cout<<g<<" ";
g=g+7;}
t=g;
int cnt =0;

while(t!=31)
{       t=t-1;
        cnt=cnt+1;}
cout<<endl<<"Month 6: ";
while(cnt<=31)
{       cout<<cnt<<" ";
cnt=cnt+7;}
t=cnt;
 cnt =0;

while(t!=30)
{       t=t-1;
        cnt=cnt+1;}
cout<<endl<<"Month 7: ";
while(cnt<=31)
{       cout<<cnt<<" ";
cnt=cnt+7;}
t=cnt;
 cnt =0;

while(t!=31)
{       t=t-1;
        cnt=cnt+1;}
cout<<endl<<"Month 8: ";
while(cnt<=31)
{       cout<<cnt<<" ";
cnt=cnt+7;}
t=cnt;
 cnt =0;

while(t!=31)
{       t=t-1;
        cnt=cnt+1;}
cout<<endl<<"Month 9: ";
while(cnt<=30)
{       cout<<cnt<<" ";
cnt=cnt+7;}
t=cnt;
 cnt =0;

      
while(t!=30)
{       t=t-1;
        cnt=cnt+1;}
cout<<endl<<"Month 10: ";
while(cnt<=31)
{       cout<<cnt<<" ";
cnt=cnt+7;}
t=cnt;
 cnt =0;

while(t!=31)
{       t=t-1;
        cnt=cnt+1;}
cout<<endl<<"Month 11: ";
while(cnt<=30)
{       cout<<cnt<<" ";
cnt=cnt+7;}

t=cnt;
 cnt =0;

while(t!=30)
{       t=t-1;
        cnt=cnt+1;}
cout<<endl<<"Month 12: ";
while(cnt<=31)
{       cout<<cnt<<" ";
cnt=cnt+7;}



}


}

Grading criterion: Correct I/O incl. Format
Rating A: I/O Handled correctly
Rating B: Error in I/O
Rating C: 0
Rating D: 0
Assigned grade: A