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;
	bool leap=false;
	if(N%100==0){
		if(N%400==0)
			leap =true;
		else
			leap =false;}
	else if(N%100!=0){
		if(N%4==0)
			leap=true;
	}
	else{
	    leap=false;
	}

	int sun;
	if(leap){
	 	sun=8-d;
		int jan=31;
		cout<<"Month 1: ";
		while(sun<=jan){
			cout<<sun<<" ";
			sun=sun+7;
		}
		cout<<"\n";
		sun=sun-7;
		sun=7-(31-sun);
		cout<<"Month 2 : ";
		while(sun<=29){
			cout<<sun<<" ";
			sun=sun+7;
		}
		cout<<endl;
		sun=sun-7;
		sun=7-(29-sun);
		cout<<"Month 3 : ";
		while(sun<=31){
                        cout<<sun<<" ";
			sun=sun+7;
		}
		cout<<endl;
		sun=sun-7;
		sun=7-(31-sun);
		cout<<"Month 4 : ";
		while(sun<=30){
			cout<<sun<<" ";
			sun=sun+7;
		}
		cout<<endl;
		sun=sun-7;
		sun=7-(30-sun);
		cout<<"Month 5 : ";
		while(sun<=31){
			cout<<sun<<" ";
			sun=sun+7;
		}
		cout<<endl;
		sun=sun-7;
		sun=7-(31-sun);
		cout<<"Month 6 : ";
		while(sun<=30){
			cout<<sun<<" ";
			sun=sun+7;
		}
		cout<<endl;
		sun=sun-7;
		sun=7-(30-sun);
		cout<<"Month 7 : ";
		while(sun<=31){
			cout<<sun<<" ";
         			sun=sun+7;}
                cout<<endl;
		sun=sun-7;
		sun=7-(31-sun);
		cout<<"Month 8 : ";
		while(sun<=31){
			cout<<sun<<" ";
			sun=sun+7;
		}
		cout<<endl;
		sun=sun-7;
		sun=7-(31-sun);
		cout<<"Month 9 : ";
		while(sun<=30){
			cout<<sun<<" ";
			sun=sun+7;
		}
		cout<<endl;
		sun=sun-7;
		sun=7-(30-sun);
		cout<<"Month 10 : ";
		while(sun<=31){
			cout<<sun<<" ";
			sun=sun+7;
		}
		cout<<endl;
		sun=sun-7;
		sun=7-(31-sun);
		cout<<"Month 11: ";
		while(sun<=30){
			cout<<sun<<" ";
			sun=sun+7;
		}
		cout<<endl;
		sun=sun-7;
		sun=7-(30-sun);
		cout<<"Month 12: ";
		while(sun<=31){
			cout<<sun<<" ";
			sun=sun+7;
		}
	}


		else{
                 sun=8-d;
		 cout<<"Month 1 : ";
		 while(sun<=31){
			 cout<<sun<<" ";
			 sun=sun+7;
		 }
		 cout<<endl;
		 sun=sun-7;
		 sun=7-(31-sun);
		 cout<<"Month 2 : ";
		 while(sun<=28){
			 cout<<sun<<" ";
			 sun=sun+7;
		 }
		 
		 cout<<endl;
		 sun=sun-7;
		 sun=7-(28-sun);
		 cout<<"Month 3 : ";
		 while(sun<=31){
			 cout<<sun<<" ";
			 sun=sun+7;
		 }
		 cout<<endl;
		 sun=sun-7;
		 sun=7-(31-sun);
		 cout<<"Month 4 : ";
		 while(sun<=30){
			 cout<<sun<<" ";
			 sun=sun+7;}
	         cout<<endl;
		 sun=sun-7;
		 sun=7-(30-sun);
		 cout<<"Month 5 : ";
		 while(sun<=31){
			 cout<<sun<<" ";
			 sun=sun+7;}
		 cout<<endl;
		 sun=sun-7;
		 sun=7-(31-sun);
		 cout<<"Month 6 : ";
		 while(sun<=30){
			 cout<<sun<<" ";
			 sun=sun+7;
		 }
		 cout<<endl;
		 sun=sun-7;
		 sun=7-(30-sun);
		 cout<<"Month 7 : ";
		 while(sun<=31){
			 cout<<sun<<" ";
			 sun=sun+7;
		 }
		 cout<<endl;
		 sun=sun-7;
		 sun=7-(31-sun);
		 cout<<"Month 8 : ";
		 while(sun<=31){
			 cout<<sun<<" ";
			 sun=sun+7;
		 }
		
		 cout<<endl;
		 sun=sun-7;
		 sun=7-(31-sun);
		 cout<<"Month 9 : ";
		 while(sun<=30){
			 cout<<sun<<" ";
			 sun=sun+7;
		 }
		 cout<<endl;
		 sun=sun-7;
		 sun=7-(30-sun);
		 cout<<"Month 10 : ";
		 while(sun<=31){
			 cout<<sun<<" ";
			 sun=sun+7;
		 }
		 cout<<endl;
		 sun=sun-7;
		 sun=7-(31-sun);
		 cout<<"Month 11 : ";
		 while(sun<=30){
			 cout<<sun<<" ";
			 sun=sun+7;
		 }
		 cout<<endl;
		 sun=sun-7;
		 sun=7-(30-sun);
		 cout<<"Month 12 : ";
		 while(sun<=31){
			 cout<<sun<<" ";
			 sun=sun+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: A