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, d,t;
	cin>>N>>d;
	if(d==1)
	{
		t=7;
	}

 if(d==2)
        {
		t=6;
        }
 if(d==3)
        {
		t=5;
        }
 if(d==4)
        {
		t=4;
        }
 if(d==5)
        {
		t=3;
        }
 if(d==6)
        {
		t=2;
        }
 if(d==7)
        {
		t=1;

	}
        

	if ((N%4)!=0 && (N%400)!=0){
			cout<<"Month1:"<<" ";
			while(t<=31){
				cout<<t<<" ";
				t+=6;
			}
			t-=31;
cout<<endl<<"Month2:"<<" ";
                        while(t<=28){
                                cout<<t<<" ";
                                t+=6;
                        }
                        t-=28;
cout<<endl<<"Month3:"<<" ";
                        while(t<=31){
                                cout<<t<<" ";
                                t+=6;
                        }
                        t-=31;
cout<<endl<<"Month4:"<<" ";
                        while(t<=30){
                                cout<<t<<" ";
                                t+=6;
                        }
                        t-=30;


cout<<endl<<"Month5:"<<" ";
                        while(t<=31){
                                cout<<t<<" ";
                                t+=6;
                        }
                        t-=31;
cout<<endl<<"Month6:"<<" ";
                        while(t<=30){
                                cout<<t<<" ";
                                t+=6;
                        }
                        t-=30;
cout<<endl<<"Month7:"<<" ";
                        while(t<=31){
                                cout<<t<<" ";
                                t+=6;
                        }
                        t-=31;
cout<<endl<<"Month8:"<<" ";
                        while(t<=31){
                                cout<<t<<" ";
                                t+=6;
                        }
                        t-=31;
cout<<endl<<"Month9:"<<" ";
                        while(t<=30){
                                cout<<t<<" ";
                                t+=6;
                        }
                        t-=30;
cout<<endl<<"Month10:"<<" ";
                        while(t<=31){
                                cout<<t<<" ";
                                t+=6;
                        }
                        t-=31;
cout<<endl<<"Month11:"<<" ";
                        while(t<=30){
                                cout<<t<<" ";
                                t+=6;
                        }
                        t-=30;
cout<<endl<<"Month12:"<<" ";
                        while(t<=31){
                                cout<<t<<" ";
                                t+=6;
                        }
                        t-=31;

	}
	else{
                        cout<<"Month1:"<<" ";
                        while(t<=31){
                                cout<<t<<" ";
                                t+=6;
                        }
                        t-=31;
cout<<endl<<"Month2:"<<" ";
                        while(t<=29){
                                cout<<t<<" ";
                                t+=6;
                        }
                        t-=29;
cout<<endl<<"Month3:"<<" ";
                        while(t<=31){
                                cout<<t<<" ";
                                t+=6;
                        }
                        t-=31;
cout<<endl<<"Month4:"<<" ";
                        while(t<=30){
                                cout<<t<<" ";
                                t+=6;
                        }
                        t-=30;


cout<<endl<<"Month5:"<<" ";
                        while(t<=31){
                                cout<<t<<" ";
                                t+=6;
                        }
                        t-=31;
cout<<endl<<"Month6:"<<" ";
                        while(t<=30){
                                cout<<t<<" ";
                                t+=6;
                        }
                        t-=30;
cout<<endl<<"Month7:"<<" ";
                        while(t<=31){
                                cout<<t<<" ";
                                t+=6;
                        }
                        t-=31;
cout<<endl<<"Month8:"<<" ";
                        while(t<=31){
                                cout<<t<<" ";
                                t+=6;
                        }
                        t-=31;
cout<<endl<<"Month9:"<<" ";
                        while(t<=30){
                                cout<<t<<" ";
                                t+=6;
                        }
                        t-=30;
cout<<endl<<"Month10:"<<" ";
                        while(t<=31){
                                cout<<t<<" ";
                                t+=6;
                        }
                        t-=31;
cout<<endl<<"Month11:"<<" ";
                        while(t<=30){
                                cout<<t<<" ";
                                t+=6;
                        }
                        t-=30;
cout<<endl<<"Month12:"<<" ";
                        while(t<=31){
                                cout<<t<<" ";
                                t+=6;
                        }
                        t-=31;

        }



}

Grading criterion: Leap Year Calculation
Rating A: All years correct (incl. Year % 400 = 0)
Rating B: Centuary Leap Year Correct (Year % 100 = 0 but Year % 400 != 0)
Rating C: Normal Leap Year correct (Year % 4 = 0 but Year % 100 != 0)
Rating D: Non-Leap Year also wrong (Year % 4 != 0)
Assigned grade: A