Question: Can I know why this code doesn't work? If the reason is because I pass today variable by reference, Can I know the reason why
Can I know why this code doesn't work? If the reason is because I pass "today" variable by reference, Can I know the reason why I can't pass the today variable by reference?
#include
int main() { Days today; string day; cout << "what day is today"; cin >> day; sToD(today,day); cout << "Today is " << today << endl< } void sToD(Days & today,string day) { switch (toupper(day[0])) { case'S':if (toupper(day[1]) == 'A') today = SATURDAY; else today = SUNDAY; break; case 'M':today = MONDAY; break; case 'T':if (toupper(day[1]) == 'U') today = TUESDAY; else today = THURSDAY; break; case'W':today = WEDNESDAY; break; case'F':today = FRIDAY; break; default: cout << "****Invalid day input****"< } }
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
