Ask Me Help Desk

Ask Me Help Desk (https://www.askmehelpdesk.com/forum.php)
-   C++ (https://www.askmehelpdesk.com/forumdisplay.php?f=439)
-   -   Using C++ (if, char or Boolean) (https://www.askmehelpdesk.com/showthread.php?t=556822)

  • Feb 22, 2011, 10:08 AM
    Sundayy
    Using C++ (if, char or Boolean)
    Using C++ (if, char or Boolean)
    Write a program that asks the user for a two digit number and then prints the English word for that number.

    Sample run:
    Enter a two-digit number: 45
    You entered the number forty-five.

    PLAN: Read the number entered as an integer and then break the number up into 2 digits. (Recall how integer division and % work…if x is an int and has the value 45, then what’s x/10 and x%10?)

    Basically, use one switch statement to print the word for the first digit (“twenty”, “thirty” and so forth). Use a second switch statement to print the word for the second digit.
    Don’t forget the numbers between 10 and 19 require special treatment.
    Make sure you only print the ‘-‘ when needed…twenty-three needs the -, thirty doesn’t

  • All times are GMT -7. The time now is 05:54 PM.