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
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started