-
February 3rd, 2014, 01:21 PM
#1
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.
-
February 3rd, 2014, 03:34 PM
#2
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 ;-)
regards,
ger
-
February 3rd, 2014, 04:19 PM
#3
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.
-
February 25th, 2014, 11:43 AM
#4
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;
count++;
}
//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
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|