#1
  1. No Profile Picture
    Contributing User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Jun 2013
    Location
    Dhaka, Bangladesh
    Posts
    116
    Rep Power
    2

    Switch statement


    For this program, a two digit number will be provided, and the English word for the number will be displayed. I am trying to use switch statements for this. For example, one switch statement will be used for naming the first digit (twenty, seventy, etc) and another will be used for naming the second digit (one, five, etc). But I am not quite sure what to do with the numbers from 11-19. Any suggestions would be helpful. Thanks in advance :)
  2. #2
  3. No Profile Picture
    Registered User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Jun 2013
    Posts
    2
    Rep Power
    0
    If you are using a switch statment for the first digit i.e. twenty, thirty... then you could use another switch statment inside the case for 1 i.e. 10 and use this switch for 10-19. So then in total you should have 3 switch statments. I dont know if that would be the most elegent solution for the problem but its only using switches.
  4. #3
  5. No Profile Picture
    Contributing User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Jun 2013
    Location
    Dhaka, Bangladesh
    Posts
    116
    Rep Power
    2
    Originally Posted by KaiUR
    If you are using a switch statment for the first digit i.e. twenty, thirty... then you could use another switch statment inside the case for 1 i.e. 10 and use this switch for 10-19. So then in total you should have 3 switch statments. I dont know if that would be the most elegent solution for the problem but its only using switches.
    Okay, I'll be trying it out after a while. Thanks for your help :)

IMN logo majestic logo threadwatch logo seochat tools logo