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 n,a,b,c,d,e,f,m,h,i,j,k,l;
	cin>>n>>a;

	if(n%4!=0){
		b=a+6;
		cout<<"Month 1:";
		while(b<32){
			cout<<b<<" ";
			b=b+7;
			}
		cout<<endl<<"Month 2:";
		c=b-31;

		while(c<29){
			cout<<c<<" ";
			c=c+7;
			}
		cout<<endl<<"Month 3:";
		
		d=c-28;
		while(d<32){
                        cout<<d<<" ";
                        d=d+7;
                        }
		cout<<endl<<"Month 4:";
		
		e=d-31;
		while(e<31){
                        cout<<e<<" ";
                        e=e+7;
                        }
		cout<<endl<<"Month 5:";

		f=e-30;

		while(f<32){
                        cout<<f<<" ";
                        f=f+7;
                        }
                cout<<endl<<"Month 6:";

		m=f-31;

		while(m<31){
                        cout<<m<<" ";
                        m=m+7;
                        }
                cout<<endl<<"Month 7:";

		h=m-30;

		while(h<32){
                        cout<<h<<" ";
                        h=h+7;
                        }
                cout<<endl<<"Month 8:";

		while(i<31){
                        cout<<i<<" ";
                        i=i+7;
                        }
                cout<<endl<<"Month 9:";

                j=i-30;

                while(j<32){
                        cout<<j<<" ";
                        j=j+7;
                        }
                cout<<endl<<"Month 10:";

                k=j-31;

                while(k<31){
                        cout<<k<<" ";
                        k=k+7;
                        }
                cout<<endl<<"Month 11";

                l=k-30;

                while(l<32){
                        cout<<l<<" ";
                        l=l+7;
                        }
                cout<<endl<<"Month 12:";















	}	



	if (n%4==0){b=a+6;
                cout<<"Month 1:";
                while(b<32){
                        cout<<b<<" ";
                        b=b+7;
                        }
                cout<<endl<<"Month 2:";
                c=b-31;

                while(c<30){
                        cout<<c<<" ";
                        c=c+7;
                        }
                cout<<endl<<"Month 3:";

                d=c-29;
                while(d<32){
                        cout<<d<<" ";
                        d=d+7;
                        }
                cout<<endl<<"Month 4:";

                e=d-31;
                while(e<31){
                        cout<<e<<" ";
                        e=e+7;
                        }
                cout<<endl<<"Month 5:";

                f=e-30;

                while(f<32){
                        cout<<f<<" ";
                        f=f+7;
                        }
                cout<<endl<<"Month 6:";

                m=f-31;

                while(m<31){
                        cout<<m<<" ";
                        m=m+7;
                        }
                cout<<endl<<"Month 7:";

                h=m-30;

                while(h<32){
                        cout<<h<<" ";
                        h=h+7;
                        }
                cout<<endl<<"Month 8:";

                while(i<31){
                        cout<<i<<" ";
                        i=i+7;
                        }
                cout<<endl<<"Month 9:";

                j=i-30;

                while(j<32){
                        cout<<j<<" ";
                        j=j+7;
                        }
                cout<<endl<<"Month 10:";

                k=j-31;

                while(k<31){
                        cout<<k<<" ";
                        k=k+7;
                        }
                cout<<endl<<"Month 11";

                l=k-30;

                while(l<32){
                        cout<<l<<" ";
                        l=l+7;
                        }
                cout<<endl<<"Month 12:";


			
}

}

Grading criterion: Sunday Date Calculation (ASSUMING Leap year calculation is correct)
Rating A: Code correct for Leap and Non leap yeat
Rating B: Code almost correct for Leap and Non leap year, some small mistake
Rating C: Code mostly incorrect,some attempt made in the right direction
Rating D: No code or completely wrong code
Assigned grade: C