You are viewing a single comment's thread. Return to all comments →
My C++ code follows. I didn't do the full nesting, but this worked for me :)
int eday, emon, eyear; int aday, amon, ayear; cin >> aday >> amon >> ayear; cin >> eday >> emon >> eyear; int fine = 0; int dyear = ayear - eyear; int dmon = amon - emon; int dday = aday - eday; if (dyear > 0) { fine = 10000; } else if (dmon > 0 && dyear == 0) { fine = 500 * dmon; } else if (dday > 0 && dmon == 0) { fine = 15 * dday; } cout << fine << endl;
Seems like cookies are disabled on this browser, please enable them to open this website
Day 26: Nested Logic
You are viewing a single comment's thread. Return to all comments →
My C++ code follows. I didn't do the full nesting, but this worked for me :)