Thread: converting numbers to words

  1. #1
    Registered User
    Join Date
    Apr 2004
    Posts
    35

    Can find y this prog dont work properly?(plz)

    none
    Last edited by dionys; 05-08-2004 at 07:42 PM.

  2. #2
    Registered User
    Join Date
    Apr 2004
    Posts
    11
    Code:
    void TransformDigitsToLetters(int n,char str[])
    {
    	/* take the first 2 digits (and save them as 14 */
          char* test[2];
          int digits;      
    
          /* "take first 2 digits", actually the last two digits: 11'14'*/
          digits = n%100;
    
          /* save them as fourteen */
         if(digits != 0){
           if(digits < 20);
                test[0] = numbers[digits -1];
           else {
                test[1] = tens[digits/10 - 1];
                if(digits%10 != 0)
                    test[0] = numbers[digits%10 - 1]
         }	
    }
    Last edited by zuiplap; 05-08-2004 at 07:58 AM.

  3. #3
    Registered User
    Join Date
    May 2004
    Posts
    127
    Quote Originally Posted by zuiplap
    Code:
    void TransformDigitsToLetters(int n,char str[])
    {
    	/* take the first 2 digits (and save them as 14 */
          char* test[2];
          int digits;      
    
          /* "take first 2 digits", actually the last two digits: 11'14'*/
          digits = n%100;
    
          /* save them as fourteen */
         if(digits != 0){
           if(digits < 20);
                test[0] = numbers[digits -1];
           else {
                test[1] = tens[digits/10 - 1];
                if(digits%10 != 0)
                    test[0] = numbers[digits%10 - 1]
         }	
    }
    Aside from posting a function that doesn't compile, you forgot to explain what part of the problem you're trying to help with. Something as simple as "Here is a function which converts numbers less than 100 to words. Modifying it for larger numbers isn't that hard once you have this," would do nicely.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Replies: 5
    Last Post: 12-21-2007, 01:38 PM
  2. Converting Numbers to Words
    By denizengt in forum C Programming
    Replies: 20
    Last Post: 11-05-2003, 09:19 PM
  3. converting numbers into words
    By Kozam in forum C Programming
    Replies: 2
    Last Post: 09-30-2003, 07:49 AM
  4. C++ program help(converting numbers to english words)
    By bama1 in forum C++ Programming
    Replies: 4
    Last Post: 10-08-2002, 01:17 AM
  5. A (complex) question on numbers
    By Unregistered in forum C++ Programming
    Replies: 8
    Last Post: 02-03-2002, 06:38 PM