Computer Science Canada

case

Author:  CHUTHAN20 [ 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.";
}

Author:  CHUTHAN20 [ Wed Mar 22, 2006 7:17 pm ]
Post subject: 

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

Author:  Andy [ Wed Mar 22, 2006 8:09 pm ]
Post subject: 

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

Author:  CHUTHAN20 [ Thu Mar 23, 2006 5:43 pm ]
Post subject: 

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

Author:  MysticVegeta [ Thu Mar 23, 2006 7:10 pm ]
Post subject: 

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

Author:  wtd [ Thu Mar 23, 2006 7:28 pm ]
Post 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

Author:  Imm0rtal [ Fri Mar 24, 2006 1:04 am ]
Post 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.

Author:  wtd [ Fri Mar 24, 2006 1:16 am ]
Post subject: 

What does .NET have to do with C++?

Author:  md [ Fri Mar 24, 2006 9:43 am ]
Post subject: 

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

Author:  CHUTHAN20 [ Sun Mar 26, 2006 5:33 pm ]
Post 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

Author:  Tony [ Sun Mar 26, 2006 5:50 pm ]
Post 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


: