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%100!=0){				//end of century year
		if (N%4==0){			//leap year
		
			int date1=-d+8;
			cout<<"Month 1: ";
			while (date1<=31){
			
				cout<<date1<<" ";
				date1=date1+7;
			}
			cout<<endl;
		
			int date2=date1-31;
			cout<<"Month 2: ";
			while (date2<=29){
			       cout<<date2<<" ";
			       date2=date2+7;
			}
			cout<<endl;

			int date3=date2-29;
			cout<<"Month 3: ";
			while (date3<=31){
				cout<<date3<<" ";
				date3=date3+7;
			}
			cout<<endl;

			int date4=date3-31;
			cout<<"Month 4: ";
			while (date4<=30){
				cout<<date4<<" ";
				date4=date4+7;
			}
			cout<<endl;

			int date5=date4-30;
			cout<<"Month 5: ";
			while (date5<=31){
				cout<<date5<<" ";
				date5=date5+7;
			}
			cout<<endl;

			int date6=date5-31;
			cout<<"Month 6: ";
			while (date6<=30){
				cout<<date6<<" ";
				date6=date6+7;
			}
			cout<<endl;

			int date7=date6-30;
			cout<<"Month 7: ";
			while (date7<=31){
				cout<<date7<<" ";
				date7=date7+7;
			}
			cout<<endl;

			int date8=date7-31;
			cout<<"Month 8: ";
			while (date8<=31){
				cout<<date8<<" ";
				date8=date8+7;
			}
			cout<<endl;

			int date9=date8-31;
			cout<<"Month 9: ";
			while(date9<=30){
				cout<<date9<<" ";
				date9=date9+7;
			}
			cout<<endl;

			int date10=date9-30;
			cout<<"Month 10: ";
			while (date10<=31){
				cout<<date10<<" ";
				date10=date10+7;
			}
			cout<<endl;

			int date11=date10-31;
			cout<<"Month 11: ";
			while (date11<=30){
				cout<<date11<<" ";
				date11=date11+7;
			}
			cout<<endl;

			int date12=date11-30;
			cout<<"Month 12: ";
			while (date12<=31){
				cout<<date12<<" ";
				date12=date12+7;
			}
			cout<<endl;				
					
		}

		else {
			int date1=-d+8;
			cout<<"Month 1: ";
			while (date1<=31){
				cout<<date1<<" ";
				date1=date1+7;
			}
			cout<<endl;

			int date2=date1-31;
			cout<<"Month 2: ";
			while (date2<=28){
				cout<<date2<<" ";
				date2=date2+7;
			}
			cout<<endl;

			int date3=date2-28;
			cout<<"Month 3: ";
			while (date3<=31){
				cout<<date3<<" ";
				date3=date3+7;
			}
			cout<<endl;

			int date4=date3-31;
			cout<<"Month 4: ";
			while (date4<=30){
				cout<<date4<<" ";
				date4=date4+7;
			}
			cout<<endl;

			int date5=date4-30;
			cout<<"Month 5: ";
			while (date5<=31){
				cout<<date5<<" ";
				date5=date5+7;
			}
			cout<<endl;

			int date6=date5-31;
			cout<<"Month 6: ";
			while(date6<=30){
				cout<<date6<<" ";
				date6=date6+7;
			}
			cout<<endl;

			int date7=date6-30;
			cout<<"Month 7: ";
			while (date7<=31){
				cout<<date7<<" ";
				date7=date7+7;
			}
			cout<<endl;

			int date8=date7-31;
			cout<<"Month 8: ";
			while (date8<=31){
				cout<<date8<<" ";
				date8=date8+7;
			}
			cout<<endl;

			int date9=date8-31;
			cout<<"Month 9: ";
			while (date9<=30){
				cout<<date9<<" ";
				date9=date9+7;
			}
			
			int date10=date9-30;
			cout<<"Month 10: ";
			while (date10<=31){
				cout<<date10<<" ";
				date10=date10+7;
			}
			cout<<endl;

			int date11=date10-31;
			cout<<"Month 11: ";
			while (date11<=30){
				cout<<date11<<" ";
				date11=date11+7;
			}
			cout<<endl;

			int date12=date11-30;
			cout<<"Month 12: ";
			while (date12<=31){
				cout<<date12<<" ";
				date12=date12+7;
			}
								
		}
	}
}

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