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>
bool isleap(int y){
	if(y%400==0){
		return true;
	}
	else if(y%100!=0&&y%4==0){
		return true;
	}
	else{
		return false;
	}
	}


main_program{
int year,pehladin;
cin>>year>>pehladin;
int month=1;
int current_sunday = 8-pehladin;

cout<<"Month 1:";
while (true){
	if (month==1){
		if(current_sunday>31){
			month+=1;
			current_sunday= current_sunday-31;
			cout<<endl;
			break;
			}
		else{
			cout<<" "<<current_sunday;
			current_sunday +=7;
			}
	
		}
}
cout<<"Month 2:";
while (true){
	if (month==2){
		if(current_sunday>29&&isleap(year)){
			month+=1;
			current_sunday= current_sunday-29;
			cout<<endl;
			break;
			}
		else if(current_sunday>28&&!isleap(year)){
			month+=1;
			current_sunday= current_sunday-28;
			cout<<endl;
			break;
			}
		else{
			cout<<" "<<current_sunday;
			current_sunday +=7;
			}
	
		}
}
cout<<"Month 3:";
while (true){
	if (month==3){
		if(current_sunday>31){
			month+=1;
			current_sunday= current_sunday-31;
			cout<<endl;
			break;
			}
		else{
			cout<<" "<<current_sunday;
			current_sunday +=7;
			}
	
		}
}
cout<<"Month 4:";
while (true){
	if (month==4){
		if(current_sunday>30){
			month+=1;
			current_sunday= current_sunday-30;
			cout<<endl;
			break;
			}
		else{
			cout<<" "<<current_sunday;
			current_sunday +=7;
			}
	
		}
}
cout<<"Month 5:";
while (true){
	if (month==5){
		if(current_sunday>31){
			month+=1;
			current_sunday= current_sunday-31;
			cout<<endl;
			break;
			}
		else{
			cout<<" "<<current_sunday;
			current_sunday +=7;
			}
	
		}
}
cout<<"Month 6:";
while (true){
	if (month==6){
		if(current_sunday>30){
			month+=1;
			current_sunday= current_sunday-30;
			cout<<endl;
			break;
			}
		else{
			cout<<" "<<current_sunday;
			current_sunday +=7;
			}
	
		}
}
cout<<"Month 7:";
while (true){
	if (month==7){
		if(current_sunday>31){
			month+=1;
			current_sunday= current_sunday-31;
			cout<<endl;
			break;
			}
		else{
			cout<<" "<<current_sunday;
			current_sunday +=7;
			}
	
		}
}
cout<<"Month 8:";
while (true){
	if (month==8){
		if(current_sunday>31){
			month+=1;
			current_sunday= current_sunday-31;
			cout<<endl;
			break;
			}
		else{
			cout<<" "<<current_sunday;
			current_sunday +=7;
			}
	
		}
}
cout<<"Month 9:";
while (true){
	if (month==9){
		if(current_sunday>30){
			month+=1;
			current_sunday= current_sunday-30;
			cout<<endl;
			break;
			}
		else{
			cout<<" "<<current_sunday;
			current_sunday +=7;
			}
	
		}
}
cout<<"Month 10:";
while (true){
	if (month==10){
		if(current_sunday>31){
			month+=1;
			current_sunday= current_sunday-31;
			cout<<endl;
			break;
			}
		else{
			cout<<" "<<current_sunday;
			current_sunday +=7;
			}
	
		}
}
cout<<"Month 11:";
while (true){
	if (month==11){
		if(current_sunday>30){
			month+=1;
			current_sunday= current_sunday-30;
			cout<<endl;
			break;
			}
		else{
			cout<<" "<<current_sunday;
			current_sunday +=7;
			}
	
		}
}
cout<<"Month 12:";
while (true){
	if (month==12){
		if(current_sunday>31){
			month+=1;
			current_sunday= current_sunday-31;
			cout<<endl;
			break;
			}
		else{
			cout<<" "<<current_sunday;
			current_sunday +=7;
			}
	
		}
}


}

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