CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 4 of 4
  1. #1
    Join Date
    Feb 2014

    Need help for a C# homework program to code!

    So I'm pretty new at programming, and I'm wondering what would be the shortest way to write a program that does this:

    Write down in letters a number provided as digits. Now this is up to 999 999 999. Any number under that needs to be able to be written down in letters, with the the proper syntax, since the language it needs to be in is french. I can just make adjustments concerning the language though, what I'd like to know is more for the procedure itself. I can just translate in french after someone shows me. I'd appreciate if someone could at least explain me a couple different ways to do it, or I'd be even happier if someone would be cool enough to actually program it so I can see how it's done. I use visual studio 2012 by the way.

  2. #2
    Join Date
    Oct 2009

    Re: Need help for a C# homework program to code!

    ha ha,

    make a setup first!!
    We will help you! we are not gonna make your homework ;-)



  3. #3
    Join Date
    Feb 2014

    Re: Need help for a C# homework program to code!

    well the whole point of this post is because i'm unsure of how to do it, ... Can't really make a set up for something I don't know how should be handled.

  4. #4
    Join Date
    Feb 2014

    Re: Need help for a C# homework program to code!

    If the number is 987, do you want to just print nine eight seven OR do you want to print nine hundred eighty seven?

    If you just want to print the number in words without hundred, thousand etc here is how you do that.

    words[] = {"zero", "one", "two","three"....so on up to nine}

    int num; //lets say this is the number which you want to print in words.
    int rem, count =0;
    while(num > 0)
    rem = num % 10; //this gives you the last digit in the number
    wordNum[count] = words[rem];
    num = num / 10;

    //now the array wordNum will have your number in words in reverse order, printing it in reverse order will give you your number in proper order

    for(int i=count-1;i>=0; i--)
    print wordNum[i];

    I hope this helps...

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Windows Mobile Development Center

Click Here to Expand Forum to Full Width

On-Demand Webinars (sponsored)

We have made updates to our Privacy Policy to reflect the implementation of the General Data Protection Regulation.