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;
	cin>>N>>d;
	if(N%4==0 && N%400==0){
		if(d==1){
		    	cout<<"Month 1: 7 14 21 28"<<endl;
			 cout<<"Month 2: 4 11 18 25"<<endl;
			 cout<<"Month 3: 3 10 17 24 31"<<endl;
			 cout<<"Month 4: 7 14 21 28"<<endl;
			 cout<<"Month 5: 5 12 19 26"<<endl;
			 cout<<"Month 6: 2 9 16 23 30"<<endl;
			 cout<<"Month 7: 7 14 21 28"<<endl;
 			cout<<"Month 8: 4 11 18 25"<<endl;
			 cout<<"Month 9: 1 8 15 22 29"<<endl;
			 cout<<"Month 10: 6 13 20 27 "<<endl;
			cout<<"Month 11: 3 10 17 24 "<<endl;
			cout<<"Month 12: 1 8 15 22 29"<<endl;

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


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

			   }



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

			}

			  

		
		}
}

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