At Monday 10/15/2007 03:51 PM, you wrote:
>so for i have this code but i dont know how ot make it say 99.99 =
>ninty nine point ninty nine
> when i input it
>
> #include<stdio.h>
>#include<string.h>
>#include<iostream.h>
> int digit;
>int main(void)
>{
>printf("Please enter a number between 0 and 99.99: \n");
> scanf("%d");
> switch(digit)
> {
> case 0: printf("Zero");
> break;
> case 1: printf("One");
> break;
> case 2: printf("Two");
> break;
> case 3: printf("Three");
> break;
> case 4:printf("Four");
> break;
> case 5:printf("Five");
> break;
> case 6:printf("Six");
> break;
> case 7:printf("Seven");
> break;
> case 8:printf("Eight");
> break;
> case 9:printf("Nine");
> break;
> case 11:printf("Ten");
> break;
> case 12:printf("Three");
> break;
> default: printf("Just a Test");
> printf("%d \n", digit);
> }
>}
>
Okay, for fun I wrote the program. It will work for numbers up to
1999999999.1999999999.
I used two output methods; one to print just the "numbers" (e.g. nine
nine point nine nine) and another to print the actual "words" (e.g.
ninety-nine point ninety-nine).
As a test, I used the first method for numbers to the left of the
decimal, and the second for numbers to the right of the decimal.
Here is a sample output:
Your number was 99.99
NINETY-NINE POINT NINE NINE
Your number was 519625.9823
FIVE HUNDRED NINETEEN THOUSAND SIX HUNDRED TWENTY-FIVE POINT NINE
EIGHT TWO THREE
Your number was 1234567890.987654321
ONE BILLION TWO HUNDRED THIRTY-FOUR MILLION FIVE HUNDRED SIXTY-SEVEN
THOUSAND EIGHT HUNDRED NINETY POINT NINE EIGHT SEVEN SIX FIVE FOUR
THREE TWO ONE
Your number was 2007.10
TWO THOUSAND SEVEN POINT ONE ZERO
The "numbers" code is quite simple, You will need to do a lot more
checking to implement the "words" code, like check the previous digit
(and decimal position) to accommodate "teens" and "*ty-" numbers.
Is this what you are trying to do?
~Rick