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

Write a program that accepts as input a date in the form e.g 12 29 2002. The pro

ID: 3624507 • Letter: W

Question

Write a program that accepts as input a date in the form e.g

12 29 2002. The program should then compute the date's position in the year.For example the date given above should display position as "363"

Please use nested loops (no arrays,functions or high level stuff etc!!!) 

Explanation / Answer

Dear user, Here is the code below: #include int main() { int day, month, year, dayNumber; char ch; cout month; cin >> ch; cin >> day; cin >> ch; cin >> year; dayNumber = 0; while ( month > 1 ) { switch( month - 1 ) { case 1 : case 3 : case 5 : case 7 : case 8 : case 10 : case 12 : dayNumber += 31; break; case 4 : case 6 : case 9 : case 11 : dayNumber += 30; break; case 2 : dayNumber += 28; if ( isLeapYear( year ) ) dayNumber++; break; } month--; } dayNumber += day; cout