I have this program made already and it works and everything, but instead of case '1' they want me to put case 'Mon'. how would I make it do that.
#include <iostream>
#include <cmath>
using namespace std;
int main(void)
{
char cDay;
char cA;
enum cDay{Mon = 1, Tue, Wed, Thur, Fri};
cout << " which day of the week, ....." << endl;
cin >> cA;
cDay = cA;
switch( cDay)
{
case '1':
cout << "Monday is work" << endl;
break;
case '2':
cout << "Tuesday is study" << endl;
break;
case '3':
cout << "Wednesday is play" << endl;
break;
case '4':
cout << "Thursday is TA run" << endl;
break;
case '5':
cout << "Friday is TA go out" << endl;
break;
#include <iostream>
#include <cmath>
usingnamespace std;
int main(void)
{
int cA; // <= should be int, not char
char cDay; // <= why both the same name??
enum cDay // <= why both the same name??
{
Mon = 1, Tue, Wed, Thur, Fri
};
cout << " which day of the week, ....." << endl;
cin >> cA;
cDay = cA; // why?? why not just switch on cA??
switch(/*cDay*/ cA)
{
case Mon: // <= like this
cout << "Monday is work" << endl;
break;
case'2':
cout << "Tuesday is study" << endl;
break;
case'3':
cout << "Wednesday is play" << endl;
break;
case'4':
cout << "Thursday is TA run" << endl;
break;
case'5':
cout << "Friday is TA go out" << endl;
break;
};
return 1;
}
Oh, i dont think that would be possible to ask to type Mon, since it has to be an interger but the program will work like this.
#include <iostream>
#include <cmath>
using namespace std;
int main(void)
{
int cA;
enum cDay
{
Mon = 1, Tue, Wed, Thur, Fri
};
cout << " which day of the week, ....." << endl;
cin >> cA;
switch( cA)
{
case Mon:
cout << "Monday is work" << endl;
break;
case Tue:
cout << "Tuesday is study" << endl;
break;
case Wed:
cout << "Wednesday is play" << endl;
break;
case Thur:
cout << "Thursday is TA run" << endl;
break;
case Fri:
cout << "Friday is TA go out" << endl;
break;