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;

	int x,y,z;

	x=n%4;
	y=n%100;
	z=n%400;

int p;

	//leap_year

	if ((y==0 && z==0) ||( x==0 && y!=0)){
	
	cout<<"Month 1:";
                for(int b=8-d; b<=31; b=b+7){
                cout<<" "<<b;
                p=b;}
		
cout<<endl;
                cout<<"Month 2:";
                for(int c=p+7-31; c<=29; c=c+7){
                cout<<" "<<c;
                p=c;}
cout<<endl;

                cout<<"Month 3:";
                for(int a=p+7-29; a<=31; a=a+7){
                cout<<" "<<a;
		p=a;
                }
cout<<endl;

                cout<<"Month 4:";
                for(int e=p+7-31; e<=30; e=e+7){
                cout<<" "<<e;
                p=e;}
cout<<endl;
                cout<<"Month 5:";
                for(int f=p+7-30; f<=31; f=f+7){
                cout<<" "<<f;
                p=f;}
cout<<endl;                
		cout<<"Month 6:";
                for(int g=p+7-31; g<=30; g=g+7){
                cout<<" "<<g;
                p=g;}
cout<<endl;
                cout<<"Month 7:";
                for( int h=p+7-30; h<=31; h=h+7){
                cout<<" "<<h;
		p=h;
                }
cout<<endl;
                cout<<"Month 8:";
                for( int i=p+7-31; i<=31; i=i+7){
                cout<<" "<<i;
                p=i;}
cout<<endl;
                cout<<"Month 9:";
                for(int j=p+7-31; j<=30; j=j+7){
                cout<<" "<<j;
               p=j; }
cout<<endl;
                cout<<"Month 10:";
                for( int k=p+7-30; k<=31; k=k+7){
                cout<<" "<<k;
               p=k; }
cout<<endl;
                cout<<"Month 11:";
                for(int l=p+7-31; l<=30; l=l+7){
                cout<<" "<<l;
               p=l; }
cout<<endl;
                cout<<"Month 12:";
                for(int m=p+7-30; m<=31; m=m+7){
                cout<<" "<<m;
                }	}
cout<<endl;
	//non_leap_year

	else{
		cout<<"Month 1:";
		for(int b=8-d; b<=31; b=b+7){
		cout<<" "<<b;
		}
cout<<endl;
		cout<<"Month 2:";
                for(b=b+7-31; b<=28; b=b+7){
                cout<<" "<<b;
                }
cout<<endl;
		cout<<"Month 3:";
                for( b=b+7-28; b<=31; b=b+7){
                cout<<" "<<b;
                }
		
cout<<endl;
		cout<<"Month 4:";
                for( b=b+7-31; b<=30; b=b+7){
                cout<<" "<<b;
                }
	cout<<endl;	
		cout<<"Month 5:";
                for( b=b+7-30; b<=31; b=b+7){
                cout<<" "<<b;
                }
		cout<<endl;
		cout<<"Month 6:";
                for( b=b+7-31; b<=30; b=b+7){
                cout<<" "<<b;
                }
		cout<<endl;
		cout<<"Month 7:";
                for( b=b+7-30; b<=31; b=b+7){
                cout<<" "<<b;
                }
		cout<<endl;
		cout<<"Month 8:";
                for( b=b+7-31; b<=31; b=b+7){
                cout<<" "<<b;
                }
		cout<<endl;
		cout<<"Month 9:";
                for( b=b+7-31; b<=30; b=b+7){
                cout<<" "<<b;
                }
		cout<<endl;
		cout<<"Month 10:";
                for( b=b+7-30; b<=31; b=b+7){
                cout<<" "<<b;
                }
cout<<endl;
		cout<<"Month 11:";
                for( b=b+7-31; b<=30; b=b+7){
                cout<<" "<<b;
                }
cout<<endl;
		cout<<"Month 12:";
                for( b=b+7-30; b<=31; b=b+7){
                cout<<" "<<b;
           cout<<endl;     }
	}
}

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