Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

Write a C++ program that takes a number in the range of 0 to 6 and a second numb

ID: 3544598 • Letter: W

Question

Write a C++ program that takes a number in the range of 0 to 6 and a second number in the range 1 to 365 as input. We are only considering non-leap years. The first number represent the day of the week on which the year begins, where 0 is Sunday, 1 is Monday and so on. The second number indicates the day of the year. The program then displays the day of the week corresponding to the day of the year and the name of the month this day falls in.

The number of the day of the week can be calculated as follows: (start day + day of year Write a C++ program that takes a number in the range of 0 to 6 and a second number in the range 1 to 365 as input. We are only considering non-leap years. The first number represent the day of the week on which the year begins, where 0 is Sunday, 1 is Monday and so on. The second number indicates the day of the year. The program then displays the day of the week corresponding to the day of the year and the name of the month this day falls in.

The number of the day of the week can be calculated as follows: (start day + day of year The number of the day of the week can be calculated as follows: (start day + day of year

Explanation / Answer

#include<iostream>

using namespace std;

#include<stack>

#include<string>

int main()

{int start,day;

while(1)

{

cout<<"enter the start day : ";

cin>>start;

cout<<"enter the day : ";

cin>>day;

if(start>6||start<0||day>365||day<1)

break;

char date[7][15]={"sunday","monday","tuesday","wednesday","thursday","friday","saturday"};

int i=((day-1)%7+start)%7;

string month;

cout<<"the day on this day is : ";

cout<<date[i]<<endl;

if((day>=1)&&(day<=31))

month="January";

else if((day>=32)&&(day<=59))

month="February";

else if((day>=60)&&(day<=90))

month="March";

else if((day>=91)&&(day<=120))

month="April";

else if((day>=121)&&(day<=151))

month="May";

else if((day>=152)&&(day<=181))

month="June";

else if((day>=182)&&(day<=212))

month="July";

else if((day>=213)&&(day<=243))

month="August";

else if((day>=244)&&(day<=273))

month="September";

else if((day>=274)&&(day<=304))

month="October";

else if((day>=305)&&(day<=334))

month="november";

else if((day>=335)&&(day<=365))

month="December";


cout<<"the month is : "<<month<<endl;



}




return 0;

}

Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote