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){
	if (N%4==0){
	cout<<"Month 1: ";
        int a=(8-d);
        while(a<=31){
                cout<<a<<" ";
                a+=7;
       }

        cout<<endl<<"Month 2: ";
        int b=((a+7)-31);
        while(b<=29){
                cout<<b<<" ";
                b+=7;
        }
        cout<<endl<<"Month 3:";
        int c=((b+7)-29);
        while(c<=31){
                cout<<c<<" ";
                c+=7;
        }
        cout<<endl<<"Month 4:";
        int D=((c+7)-31);
        while(D<=30){
                cout<<D<<" ";
                D+=7;
        }
        cout<<endl<<"Month 5:";
        int e=((D+7)-30);
        while(e<=31){
                cout<<e<<" ";
                e+=7;
        }
        cout<<endl<<"Month 6:";
        int f=((e+7)-31);
        while(f<=30){
                cout<<f<<" ";
                f+=7;
        }
        cout<<endl<<"Month 7:";
        int g=((f+7)-30);
        while(g<=31){
                cout<<g<<" ";
                g+=7;
        }
        cout<<endl<<"Month 8:";
        int h=((g+7)-31);
        while(h<=31){
                cout<<h<<" ";
                h+=7;
        }
        cout<<endl<<"Month 9:";
        int i=((h+7)-31);
        while(i<=30){
                cout<<i<<" ";
                i+=7;
        }
        cout<<endl<<"Month 10:";
        int j=((i+7)-30);
        while(j<=31){
                cout<<j<<" ";
                j+=7;
        }
        cout<<endl<<"Month 11:";
        int k=((j+7)-31);
        while(k<=30){
                cout<<k<<" ";
                k+=7;
        }
        cout<<endl<<"Month 12:";
        int l=((k+7)-30);
        while(l<=31){
                cout<<l<<" ";
                l+=7;
        }

	}
	else {

	cout<<endl<<"Month 1: ";
	int a=(8-d);
	while(a<=31){
		cout<<a<<" ";
		a+=7;
	}
	cout<<endl<<"Month 2: ";
	int b=((a+7)-31);
	while(b<=28){
		cout<<b<<" ";
		b+=7;
	}
	cout<<endl<<"Month 3: ";
	int c=((b+7)-28);
	while(c<=31){
		cout<<c<<" ";
		c+=7;
	}
	cout<<endl<<"Month 4: ";
        int D=((c+7)-31);
        while(D<=30){
                cout<<D<<" ";
                D+=7;
        }
	cout<<endl<<"Month 5: ";
        int e=((D+7)-30);
        while(e<=31){
                cout<<e<<" ";
                e+=7;
        }
	cout<<endl<<"Month 6: ";
        int f=((e+7)-31);
        while(f<=30){
                cout<<f<<" ";
                f+=7;
        }
	cout<<endl<<"Month 7: ";
        int g=((f+7)-30);
        while(g<=31){
                cout<<g<<" ";
                g+=7;
        }
	cout<<endl<<"Month 8: ";
        int h=((g+7)-31);
        while(h<=31){
                cout<<h<<" ";
                h+=7;
        }
	cout<<endl<<"Month 9: ";
        int i=((h+7)-31);
        while(i<=30){
                cout<<i<<" ";
                i+=7;
        }
	cout<<endl<<"Month 10: ";
        int j=((i+7)-30);
        while(j<=31){
                cout<<j<<" ";
                j+=7;
        }
	cout<<endl<<"Month 11: ";
        int k=((j+7)-31);
        while(k<=30){
                cout<<k<<" ";
                k+=7;
        }
	cout<<endl<<"Month 12: ";
        int l=((k+7)-30);
        while(l<=31){
                cout<<l<<" ";
                l+=7;
        }


	}
}

else {
	if (N%4==0){
	cout<<"Month 1: ";
        int a=(8-d);
        while(a<=31){
                cout<<a<<" ";
                a+=7;
       }

        cout<<endl<<"Month 2: ";
        int b=((a+7)-31);
        while(b<=29){
                cout<<b<<" ";
                b+=7;
        }
        cout<<endl<<"Month 3:";
        int c=((b+7)-29);
        while(c<=31){
                cout<<c<<" ";
                c+=7;
        }
        cout<<endl<<"Month 4:";
        int D=((c+7)-31);
        while(D<=30){
                cout<<D<<" ";
                D+=7;
        }
        cout<<endl<<"Month 5:";
        int e=((D+7)-30);
        while(e<=31){
                cout<<e<<" ";
                e+=7;
        }
        cout<<endl<<"Month 6:";
        int f=((e+7)-31);
        while(f<=30){
                cout<<f<<" ";
                f+=7;
        }
        cout<<endl<<"Month 7:";
        int g=((f+7)-30);
        while(g<=31){
                cout<<g<<" ";
                g+=7;
        }
        cout<<endl<<"Month 8:";
        int h=((g+7)-31);
        while(h<=31){
                cout<<h<<" ";
                h+=7;
        }
        cout<<endl<<"Month 9:";
        int i=((h+7)-31);
        while(i<=30){
                cout<<i<<" ";
                i+=7;
        }
        cout<<endl<<"Month 10:";
        int j=((i+7)-30);
        while(j<=31){
                cout<<j<<" ";
                j+=7;
        }
        cout<<endl<<"Month 11:";
        int k=((j+7)-31);
        while(k<=30){
                cout<<k<<" ";
                k+=7;
        }
        cout<<endl<<"Month 12:";
        int l=((k+7)-30);
        while(l<=31){
                cout<<l<<" ";
                l+=7;
        }

        }


	else {
	        cout<<endl<<"Month 1: ";
        int a=(8-d);
        while(a<=31){
                cout<<a<<" ";
                a+=7;
        }
        cout<<endl<<"Month 2: ";
        int b=((a+7)-31);
        while(b<=28){
                cout<<b<<" ";
                b+=7;
        }
        cout<<endl<<"Month 3: ";
        int c=((b+7)-28);
        while(c<=31){
                cout<<c<<" ";
                c+=7;
        }
        cout<<endl<<"Month 4: ";
        int D=((c+7)-31);
        while(D<=30){
                cout<<D<<" ";
                D+=7;
        }
        cout<<endl<<"Month 5: ";
        int e=((D+7)-30);
        while(e<=31){
                cout<<e<<" ";
                e+=7;
        }
        cout<<endl<<"Month 6: ";
        int f=((e+7)-31);
        while(f<=30){
                cout<<f<<" ";
                f+=7;
        }
        cout<<endl<<"Month 7: ";
        int g=((f+7)-30);
        while(g<=31){
                cout<<g<<" ";
                g+=7;
        }
        cout<<endl<<"Month 8: ";
        int h=((g+7)-31);
        while(h<=31){
                cout<<h<<" ";
                h+=7;
        }
        cout<<endl<<"Month 9: ";
        int i=((h+7)-31);
        while(i<=30){
                cout<<i<<" ";
                i+=7;
        }
        cout<<endl<<"Month 10: ";
        int j=((i+7)-30);
        while(j<=31){
                cout<<j<<" ";
                j+=7;
        }
        cout<<endl<<"Month 11: ";
        int k=((j+7)-31);
        while(k<=30){
                cout<<k<<" ";
                k+=7;
        }
        cout<<endl<<"Month 12: ";
        int l=((k+7)-30);
        while(l<=31){
                cout<<l<<" ";
                l+=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