Programming C, C++, Java, PHP, Ruby, Turing, VB
Computer Science Canada 
Programming C, C++, Java, PHP, Ruby, Turing, VB  

Username:   Password: 
 RegisterRegister   
 case
Index -> Programming, C++ -> C++ Help
View previous topic Printable versionDownload TopicSubscribe to this topicPrivate MessagesRefresh page View next topic
Author Message
CHUTHAN20




PostPosted: Wed Mar 22, 2006 6:48 pm   Post subject: case

code:

switch(m)
 {
  case 1 : cout<<"January";
        break;
  case 2 : cout<<"February";
 }


Instead of using case 1, case 2 or case 3, can i use a word like

code:


switch (m)
{
        January: cout <<"1st month of the year.";
        break;
        February: cout<<"2nd month of the year.";
}
Sponsor
Sponsor
Sponsor
sponsor
CHUTHAN20




PostPosted: Wed Mar 22, 2006 7:17 pm   Post subject: (No subject)

i forgot to mention that i use turbo c++ v4.5
Andy




PostPosted: Wed Mar 22, 2006 8:09 pm   Post subject: (No subject)

ummm if i understand your question correctly, then you can use ENUMs to enumerate January, Februrary and so on as 1,2,3...
CHUTHAN20




PostPosted: Thu Mar 23, 2006 5:43 pm   Post subject: (No subject)

Confused andy... a example with a code would be really help full.
MysticVegeta




PostPosted: Thu Mar 23, 2006 7:10 pm   Post subject: (No subject)

why cant you have an array of months in strings. then you just need to go
month = monthArray[m];
wtd




PostPosted: Thu Mar 23, 2006 7:28 pm   Post subject: (No subject)

CHUTHAN20 wrote:
i forgot to mention that i use turbo c++ v4.5


Anyu particular reason you haven't joined the rest of the world in the 21st century? Smile
Imm0rtal




PostPosted: Fri Mar 24, 2006 1:04 am   Post subject: (No subject)

wtd wrote:
CHUTHAN20 wrote:
i forgot to mention that i use turbo c++ v4.5


Anyu particular reason you haven't joined the rest of the world in the 21st century? Smile


.NET doesn't port to Linux is my excuse.
wtd




PostPosted: Fri Mar 24, 2006 1:16 am   Post subject: (No subject)

What does .NET have to do with C++?
Sponsor
Sponsor
Sponsor
sponsor
md




PostPosted: Fri Mar 24, 2006 9:43 am   Post subject: (No subject)

And .NET does port to linux it's called mono.
CHUTHAN20




PostPosted: Sun Mar 26, 2006 5:33 pm   Post subject: (No subject)

wtd wrote:
CHUTHAN20 wrote:
i forgot to mention that i use turbo c++ v4.5


Anyu particular reason you haven't joined the rest of the world in the 21st century? Smile


cuz... i am begineer to c++ and.. i started to learn with turbo first.. so now its kinda hard to switch. but i like turbo c++ Exclamation
Tony




PostPosted: Sun Mar 26, 2006 5:50 pm   Post subject: (No subject)

CHUTHAN20 wrote:
cuz... i am begineer to c++ and.. i started to learn with turbo first.. so now its kinda hard to switch. but i like turbo c++ Exclamation

well that's like saying that "well hey, I've started with DOS for an OS first...". Now I truly hope that you're using something better for your OS. Laughing
Latest from compsci.ca/blog: Tony's programming blog. DWITE - a programming contest.
Display posts from previous:   
   Index -> Programming, C++ -> C++ Help
View previous topic Tell A FriendPrintable versionDownload TopicSubscribe to this topicPrivate MessagesRefresh page View next topic

Page 1 of 1  [ 11 Posts ]
Jump to:   


Style:  
Search: