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<iostream>
using namespace std;
int main()
	{
		int Y,d;
		cin>>Y>>d;
		int  m1=8-d, m2=5-d,m3=5-d,m3=d,m4=7-d,m5=4-d,m6=d,m7=6-d,m8=3-d,m9=8-d,m10=5-d,m11=3-d,m12=7-d;
		cout<<"Month1:";
		while(m1<=31)
			{
				cout<<m1<<" ";
				m1+=7;
				
			}

	        if(Y!=4)
			{
				cout<<"Month2: ;
				while(m2<=28){
					cout<<m2<<" ";
				m2+=7;}
				                                cout<<"Month3: ;
                                while(m3<=31){
                                        cout<<m3<<" ";
                                m3+=7;}
                                cout<<"Month4: ;
                                while(m4<=30){
                                        cout<<m4<<" ";
                                m4+=7;}
                                cout<<"Month5: ;
                                while(m5<=31){
                                        cout<<m5<<" ";
                                m5+=7;}
                                cout<<"Month6: ;
                                while(m6<=30){
                                        cout<<m6<<" ";
                                m6+=7;}
                                cout<<"Month7: ;
                                while(m7<=31){
                                        cout<<m7<<" ";
                                m7+=7;}
                                cout<<"Month8: ;
                                while(m8<=31){
                                        cout<<m8<<" ";
                                m8+=7;}
                                cout<<"Month9: ;
                                while(m9<=30){
                                        cout<<m9<<" ";
                                m9+=7;}
				                                cout<<"Month10: ;
                                while(m10<=31){
                                        cout<<m10<<" ";
                                m10+=7;}
                                cout<<"Month11: ;
                                while(m11<=30){
                                        cout<<m11<<" ";
                                m11+=7;}
                                cout<<"Month12: ;
                                while(m12<=31){
                                        cout<<m12<<" ";
                                m12+=7;}
			


		
																	                        }

	
	}

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: D