enum help! - Programmers Heaven

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!


Welcome to the new platform of Programmer's Heaven! We apologize for the inconvenience caused, if you visited us from a broken link of the previous version. The main reason to move to a new platform is to provide more effective and collaborative experience to you all. Please feel free to experience the new platform and use its exciting features. Contact us for any issue that you need to get clarified. We are more than happy to help you.

enum help!

hosh0hosh0 Posts: 2Member
hey all, just started c++ and got a bit of a problem with a piece of code i wrote
if i put it all in one function (main) it works a charm, but soon as i move it around 2 serperate functions (as i have to do :( ) i get a problem where my value is not passed to my last function

ne how here is the chunk of my code that isnt workin


using namespace std;

enum Day {Sun=1,Mon,Tues,Wed,Thurs,Fri,Sat};

void GetDay(Day &D);

void PrintDay(Day D);

int main ()


Day D;

GetDay (D);


return 0;


void GetDay(Day &D)


cout << "Please Select The Day From The List Bewlow: " << endl;

cout << "(1) Sunday " << endl

<< "(2) Monday " << endl

<< "(3) Tuesday " << endl

<< "(4) Wednesday " << endl

<< "(5) Thursday " << endl

<< "(6) Friday " << endl

<< "(7) Saturday " << endl;

cin >> static_cast (D);

cout << endl;


void PrintDay(Day D)


switch (D)


case Sun : cout << "Sunday" << endl;


case Mon : cout << "Monday" << endl;


case Tues : cout << "Tuesday" << endl;


case Wed : cout << "Wednesday" << endl;


case Thurs: cout << "Thursday" << endl;


case Fri : cout << "Friday " << endl;


case Sat: cout << "Saturday " << endl;





Sign In or Register to comment.