Need help with computer science and loop in c++ based on input
Need help with computer science and loop in c++ based on input
I need some correction in final step printing the last part. For some reason the middle part of the program does not apply in the end…
int main(){
int year, month, days;
cout << "Enter month (1-12): ";
cin >> month;
cout << "Enter year (1990-): ";
cin >> year;
static int t[] = {0, 3, 2, 5, 0, 3, 5, 1, 4, 6, 2, 4};
int y = year - (month < 3);
int dayOfWeek = (y + y/4 - y/100 + y/400 + t[month-1] + 1) % 7;
switch(month){
case 1: cout << "January "; break; case 2: cout << "February "; break; case 3: cout << "March "; break; case 4: cout << "April "; break;
case 5: cout << "May "; break; case 6: cout << "June "; break; case 7: cout << "July "; break; case 8: cout << "August "; break;
case 9: cout << "September "; break; case 10: cout << "October "; break; case 11: cout << "November "; break; case 12: cout << "December ";
cout << month << endl;
}
cout << year << endl;
cout << "Mon Tue Wed Thu Fri Sat Sun" << endl;
if(month > 0 && month < 13){
while(month > 0){
}
}
else{
cout << "Error." << endl;
}
}
"You need a similar assignment done from scratch? Our qualified writers will help you with a guaranteed AI-free & plagiarism-free A+ quality paper, Confidentiality, Timely delivery & Livechat/phone Support.
Discount Code: CIPD30
Click ORDER NOW..


