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 N, d;
	cin>>N>>d;

	if(N%4==0 && N%100!=0){
		if(d==1){
			cout<<"Month 1: 7 14 21 28"<<"\n";
			cout<<"Month 2: 4 11 18 25"<<"\n";
			cout<<"Month 3: 3 10 17 24 31"<<"\n";
			cout<<"Month 4: 7 14 21 28"<<"\n";
			cout<<"Month 5: 5 12 19 26"<<"\n";
			cout<<"Month 6: 2 9 16 23 30"<<"\n";
			cout<<"Month 7: 7 14 21 28"<<"\n";
			cout<<"Month 8: 4 11 18 25"<<"\n";
			cout<<"Month 9: 1 8 15 22 29"<<"\n";
			cout<<"Month 10: 6 13 20 27"<<"\n";
			cout<<"Month 11: 3 10 17 24"<<"\n";
			cout<<"Month 12: 1 8 15 22 29"<<"\n";
		}
		if(d==2){
			cout<<"Month 1: 6 13 20 27"<<"\n";
                        cout<<"Month 2: 3 10 17 24"<<"\n";
                        cout<<"Month 3: 2 9 16 23 30"<<"\n";
                        cout<<"Month 4: 6 13 20 27"<<"\n";
                        cout<<"Month 5: 4 11 18 25"<<"\n";
                        cout<<"Month 6: 1 8 15 22 29"<<"\n";
                        cout<<"Month 7: 6 13 20 27"<<"\n";
                        cout<<"Month 8: 3 10 17 24"<<"\n";
                        cout<<"Month 9: 7 14 21 28"<<"\n";
                        cout<<"Month 10: 5 12 19 26"<<"\n";
                        cout<<"Month 11: 2 9 16 23"<<"\n";
                        cout<<"Month 12: 7 14 21 28"<<"\n";
                }
		if(d==3){
	      		cout<<"Month 1: 5 12 19 26"<<"\n";
                        cout<<"Month 2: 2 9 16 23"<<"\n";
                        cout<<"Month 3: 1 8 15 22 29"<<"\n";
                        cout<<"Month 4: 6 12 19 26"<<"\n";
                        cout<<"Month 5: 3 10 17 24"<<"\n";
                        cout<<"Month 6: 7 14 21 28"<<"\n";
                        cout<<"Month 7: 5 12 19 26"<<"\n";
                        cout<<"Month 8: 2 9 16 23"<<"\n";
                        cout<<"Month 9: 6 13 20 29"<<"\n";
                        cout<<"Month 10: 4 11 18 25"<<"\n";
                        cout<<"Month 11: 1 8 15 22"<<"\n";
                        cout<<"Month 12: 6 13 20 27"<<"\n";
                }
		if(d==4){
                        cout<<"Month 1: 4 11 18 25"<<"\n";
                        cout<<"Month 2: 1 8 14 21"<<"\n";
                        cout<<"Month 3: 7 14 21 27"<<"\n";
                        cout<<"Month 4: 5 11 18 25"<<"\n";
                        cout<<"Month 5: 2 9 16 23"<<"\n";
                        cout<<"Month 6: 6 13 20 27"<<"\n";
                        cout<<"Month 7: 4 11 18 25"<<"\n";
                        cout<<"Month 8: 1 8 15 22 29"<<"\n";
                        cout<<"Month 9: 5 12 19 27"<<"\n";
                        cout<<"Month 10: 3 10 17 24"<<"\n";
                        cout<<"Month 11: 7 14 21 28"<<"\n";
                        cout<<"Month 12: 5 12 19 26"<<"\n";
                }
		if(d==5){
                        cout<<"Month 1: 3 11 17 24"<<"\n";
                        cout<<"Month 2: 7 14 22 29"<<"\n";
                        cout<<"Month 3: 6 13 20 27"<<"\n";
                        cout<<"Month 4: 4 10 17 24"<<"\n";
                        cout<<"Month 5: 1 8 15 22"<<"\n";
                        cout<<"Month 6: 5 12 19 26"<<"\n";
                        cout<<"Month 7: 3 10 17 24"<<"\n";
                        cout<<"Month 8: 7 14 21 28"<<"\n";
                        cout<<"Month 9: 4 11 19 27"<<"\n";
                        cout<<"Month 10: 3 9 16 24"<<"\n";
                        cout<<"Month 11: 5 12 19 26"<<"\n";
			cout<<"Month 12: 4 11 18 25"<<"\n";
                }
		


	}
	else if(N%400==0){


	}
	else{


	}



}

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