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 year , day ;
	cin>> year>> day ;
	bool isLeap ;
	int date;
	
	if(year%4==0){
		if(year%100==0){
			if(year%400==0){
				isLeap=True;
			}
			else{
				isLeap=False;
			}
			
		}
		else{
		isLeap=True;
		}
	}
	else{
		isLeap=False;
	}
	
	if(isLeap==True){
		if(day==7){
			date=1;
			}
		if(day==6){
			date=2;
			}
		if(day==5){
			date=3;
			}
		if(day==4){
			date=4;
			}
		if(day==3){
			date=5;
			}
		if(day==2){
			date=6;
			}
		if(day==1){
			date=7;
			}
		cout<<"Month 1:" ;
		while(date<=31){
			cout<<" "<<date;
			date=date+7;
				}
		cout<<endl<<"Month 2:" ;
		while(date<=60){
				cout<<" "<<date-31;
				date=date+7;
				
				}
		cout<<endl<<"Month 3:" ;
		while(date<=91){
				cout<<" "<<date-60;
				date=date+7;
				}
		cout<<endl<<"Month 4:" ;
		while(date<=121){
				cout<<" "<<date-91;
				date=date+7;
				}
		cout<<endl<<"Month 5:" ;
		while(date<=152){
				cout<<" "<<date-121;
				date=date+7;
				}
		cout<<endl<<"Month 6:" ;
		while(date<=182){
				cout<<" "<<date-152;
				date=date+7;
				}
		cout<<endl<<"Month 7:" ;
		while(date<=213){
				cout<<" "<<date-182;
				date=date+7;
				}
		cout<<endl<<"Month 8:" ;
		while(date<=244){
				cout<<" "<<date-213;
				date=date+7;
				}
		cout<<endl<<"Month 9:" ;
		while(date<=274){
				cout<<" "<<date-244;
				date=date+7;
				}
		cout<<endl<<"Month 10:" ;
		while(date<=305){
				cout<<" "<<date-274;
				date=date+7;
				}
		cout<<endl<<"Month 11:" ;
		while(date<=335){
				cout<<" "<<date-305;
				date=date+7;
				}
		cout<<endl<<"Month 12:" ;
		while(date<=366){
				cout<<" "<<date-335;
				date=date+7;
				}	
			
	}
	
	else{
		if(day==7){
			date=1;
			}
		if(day==6){
			date=2;
			}
		if(day==5){
			date=3;
			}
		if(day==4){
			date=4;
			}
		if(day==3){
			date=5;
			}
		if(day==2){
			date=6;
			}
		if(day==1){
			date=7;
			}
		cout<<"Month 1:" ;
		while(date<=31){
			cout<<" "<<date;
			date=date+7;
				}
		cout<<endl<<"Month 2:" ;
		while(date<=59){
				cout<<" "<<date-31;
				date=date+7;
				
				}
		cout<<endl<<"Month 3:" ;
		while(date<=90){
				cout<<" "<<date-59;
				date=date+7;
				}
		cout<<endl<<"Month 4:" ;
		while(date<=121){
				cout<<" "<<date-90;
				date=date+7;
				}
		cout<<endl<<"Month 5:" ;
		while(date<=151){
				cout<<" "<<date-120;
				date=date+7;
				}
		cout<<endl<<"Month 6:" ;
		while(date<=181){
				cout<<" "<<date-151;
				date=date+7;
				}
		cout<<endl<<"Month 7:" ;
		while(date<=212){
				cout<<" "<<date-181;
				date=date+7;
				}
		cout<<endl<<"Month 8:" ;
		while(date<=243){
				cout<<" "<<date-212;
				date=date+7;
				}
		cout<<endl<<"Month 9:" ;
		while(date<=273){
				cout<<" "<<date-243;
				date=date+7;
				}
		cout<<endl<<"Month 10:" ;
		while(date<=304){
				cout<<" "<<date-273;
				date=date+7;
				}
		cout<<endl<<"Month 11:" ;
		while(date<=334){
				cout<<" "<<date-304;
				date=date+7;
				}
		cout<<endl<<"Month 12:" ;
		while(date<=365){
				cout<<" "<<date-334;
				date=date+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