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 y, n;
	cin>> y>> n;
	int x=n;
	int i=2;
	cout<<"Month 1: ";
	x=8-x;
	while(x<31){
		cout<<x<< " ";
		x=x+7;
	}
	x=8-x;
	if((y%100==0)||(x%4!=0)){
		cout<<"Month "<< i<<": ";
		if(x<5){
			x=5-x;}
		else{
			x=12-x;
		}
		while(x<29){
			cout<< x<< " ";
			x+=7;
		}cout<< endl;
		x=n;
		cout<< "Month "<< 3<<": ";
		if(x>4){
			x=12-x;
		}
			else{x=5-x;}
                        while(x<32){
				cout<< x<< " ";
			x=x+7;

	}cout<<endl;
			x=n;
			cout<< "Month 4; ";
			if (x!=1){x=9-x;}
			else{x=x;}
			while(x<31){
				cout<< x<<" ";
				x=x+7;
			}
			cout<<endl;
			x=n;
			cout<< "Month 5: ";
			if(x!=7){x=7-x;
			}
			else{x=x;}
			while(x<32){
                                cout<< x<<" ";
                                x=x+7;
                        }
                        cout<<endl;
                        x=n;
                        cout<< "Month 6: ";
			if(x>3){x=11-x;
			}
			else{x=4-x;}
			while(x<31){
                                cout<< x<<" ";
                                x=x+7;
                        }
                        cout<<endl;
                        x=n;
                        cout<< "Month 7: ";
				if(x!=1){x=9-x;}
				else{x=x;
				}
				while(x<32){
                                cout<< x<<" ";
                                x=x+7;
                        }
                        cout<<endl;
                        x=n;
                        cout<< "Month 8: ";
			if(x>5){x=13-x;
			}
			else{x=6-x;}
			while(x<32){
                                cout<< x<<" ";
                                x=x+7;
                        }
                        cout<<endl;
                        x=n;
                        cout<< "Month 9: ";
			if(x>2){x=10-x;
			}
			else{x=3-x;}
			while(x<31){
                                cout<< x<<" ";
                                x=x+7;
                        }
                        cout<<endl;
                        x=n;
                        cout<< "Month 10: ";
			x=8-x;
			while(x<32){
                                cout<< x<<" ";
                                x=x+7;
                        }
                        cout<<endl;
                        x=n;
                        cout<< "Month 11: ";
			if(x<5){x=5-x;}
			else{x=12-x;}
			while(x<31){
                                cout<< x<<" ";
                                x=x+7;
                        }
                        cout<<endl;
                        x=n;
                        cout<< "Month 12: ";
			if(x>2){x=10-x;}
			else{x=3-x;}
			while(x<31){
                                cout<< x<<" ";
                                x=x+7;
                        }
	}
}

Grading criterion: Quality of variable names
Rating A: good variable names
Rating B: Ok Variable Name
Rating C: Poor Variable Names
Rating D: 0
Assigned grade: B