Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Trying to take input of int month from user and convert it to string month..What do you think is making it print default and not

Trying to take input of int month from user and convert it to string month..What do you think is making it print default and not my input?

Please note that this is only part of my code. Also, I have created a class called DayOfYear

int main() { int Pass1; DayOfYear Day2; Day2.input(); cout< 
void DayOfYear::input() { int d, m, y; cout<<"Enter Month: "; cin>>d; cout<<"Enter Day: "; cin>>m; cout<<"Enter Year: "; cin>>y; }
string DayOfYear::monthHelper(int Num) { string mth; switch (Num) { case 1: mth = "January"; break; case 2: mth = "February"; break; case 3: mth = "March"; break; case 4: mth = "April"; break; case 5: mth = "May"; break; case 6: mth = "June"; break; case 7: mth = "July"; break; case 8: mth = "August"; break; case 9: mth = "September"; break; case 10: mth = "October"; break; case 11: mth = "November"; break; case 12: mth = "December"; break; } return mth; }

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Databases In Networked Information Systems 6th International Workshop Dnis 2010 Aizu Wakamatsu Japan March 2010 Proceedings Lncs 5999

Authors: Shinji Kikuchi ,Shelly Sachdeva ,Subhash Bhalla

2010th Edition

3642120377, 978-3642120374

More Books

Students also viewed these Databases questions