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

Grading criterion: Quality and number of comments
Rating A: Well Commented
Rating B: Ok Commented
Rating C: Poor or No Comments
Rating D: 0
Assigned grade: C