Question: I have this C++ program below and when I enter an int (say 12) I want it to print out the corresponding month (so December)

I have this C++ program below and when I enter an int (say 12) I want it to print out the corresponding month (so December) at this point it only returns the number 12. Thank you in advance for any help

#include

using namespace std;

enum Month {January = 1 ,February = 2, March = 3, April = 4, May = 5,

June = 6, July = 7, August = 8, September = 9, October = 10,

November = 11, December = 12};

void GetMonth(Month &Mth){

int m ;

cout << "Enter a month: ";

cin >> m;

Mth = (Month) m;

}

void PrintMonth(Month Mth){

cout << "Month is ";

cout <

}

int main()

{

Month month;

GetMonth(month);

PrintMonth(month);

}

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!