Is anyone here an expert on C Language Programming?
By jeeyah
@jeeyah (1092)
Philippines
December 24, 2010 11:25am CST
I know it's Christmas right now (Merry Christmas to everyone! I'm pretty sure not everyone here is a Christian, but still, let's celebrate just for the holidays! Heehee)
Anyway, I have this machine problem that I need to do for my programming class. I need to make a program that could translate any number [from 1 to 1 million] to words. (Example: 12345 == Twelve Thousand Three Hundred Forty Five).
I have already tried to GOOGLE for help, I've checked out websites, forum discussions, Yahoo! Answers, etc., but I am a bit confused on what to do. My class instructor has not taught us the complicated stuff yet, and we kinda have to figure this out on our own. I've read that I need to use stuff like char, arrays, etc. for this program, but I am just SO CONFUSED.
Can somebody give me a sort of explanation which is suitable for STARTERS like me? Orr, can anyone give me something to read which can help me understand everything better?
I need to figure out how to code this program before January, so yea. Huhu helpp! Let it be your Christmas gift to me. :D
Any help would be highly appreciated, thanks you guysss!!
1 person likes this
5 responses
@thesids (22180)
• Bhubaneswar, India
24 Dec 10
Hi Jeeyah
Here is some thing that should help you...
Start by creating arrays - the string ones (char) - and store the numbers in them as ONE, TWO ... ten, twenty, ... hundred,.. thousand.
Then count the number of digits in the input (if you accept the input as string then use strlen() that is easy but if you accept it as long or double, use your function to return number of digits.
Then start with a switch case thing where you first check the position and then the digit. That should get you through.
I could write the code tough and send it across but that would be unfair to you and your teachers. Study hard as this C is the Sea and the chore of all programming on Computers.
MERRY CHRSITMAS,
theSids.
2 people like this
@hora_fugit (5862)
• India
24 Dec 10
Liked it very much :)
My idea was about dividing the input in two parts (if writing in x,xxx,xxx format); also string concept... would have been easy if prior experience. Whatever... ;)
Last paragraph is something with most importance here. Salutes to you for that
Happy holidays ^^
@jeeyah (1092)
• Philippines
26 Dec 10
Hey there thesids!! WOW. I will save what you said! Haha. I'll use it as reference, and I believe it will really help a lot! I'll try and start doing it maybe later tonight or tomorrow.
And yes, I would not want anyone to just straight out give me the code without letting me understand any of it. I really want to learn, and I don't get the point of "going to school" if I won't really understand what I'm doing. I'm a big hater of flat-out "copying". So what you did is really a big big help and I appreciate that you took the time to teach me and guide me, instead of "spoonfeeding" the answer to me! I'll really keep your clues in mind. :D
Merry Christmas!
@hora_fugit (5862)
• India
24 Dec 10
Hope someone can help you here...
I could solve this problem, but my mind doesn't work "oh, it is solved as..." that is I don't get a method instantaneously. It comes in parts, or modules if you understand
Besides, can't guess how much you have been taught... strings and so on... And no, I'm not an expert!! [But I could try]
Happy holiday May you get your gift delivered on time :)
@jeeyah (1092)
• Philippines
24 Dec 10
Thank you! Your response is well-appreciated. :)
Anyway, do you at least have an idea on what I should use?
And so far, I only know about the basic functions (printf, scanf), some stuff about the data types char, int, double, and float. Some basic stuff about the switch, if, if-else, while loops. I'm pretty sure that's about it. Just pretty basic stuff -_-
And I think I'm not quite familiar yets with strings, arrays and such. :(
Do you know any website or book which I can use as a reference? I'd really like to read on it.
And again, thank you so muchh! Happy holidays too, and I really hope that it does get delivered on time. Heehee. :)
1 person likes this
@hora_fugit (5862)
• India
24 Dec 10
Hmmm.. Solved?
My best advice could be: solve in parts, start with simpler inputs to longer ones.
It may seem strange, but I didn't learn from any book but the IDE itself and by experience. So no idea about reference...
Please post when you get your answer (not the answer though LOL)
@jeeyah (1092)
• Philippines
26 Dec 10
Wow, may I ask how much time it took you in order to get a hang of it? Because I obviously need practice, lol. I haven't really taken the time to code and just do some exercises because, well, I don't have much free time. Haha!
And I will! I'll try to solve it and read on some stuff over the remaining days of my break. Hopefully I finish it before classes resume on January. Whew!
Thank you so much for the help & enlightenment! :)
1 person likes this
@Hatley (163776)
• Garden Grove, California
24 Dec 10
jeeyah hi oh my wish my computer nerd, thats his term, son was
here as he has studied all that c language stuff and he would
soon have you sorted out. let me give you his email address
and give him your question. HIs name is Robbie,his email
address is lonewolf@well.com.Alsoo there are books about
c plus language you can check out at any library anywhere
good luck and God bless.
1 person likes this
@jeeyah (1092)
• Philippines
26 Dec 10
Hey there Hatley! Wow, what course did your son take up in college? You must be proud! :) And thank you thank you so much! I'll try to contact him if I really run out of resources already and if I become so helpless and desperate already. Lol. I'll try to research first and yea. I'd really love to ask for his help, but he might get weirded out by a complete stranger asking him about codes! Haha, and I don't want to bother him since he may also be busy. But really, thanks so much Hatley! :)
@cerebellum (3863)
• United States
24 Dec 10
Sorry! I wish I could help you, but I am confused also. I would probably make it harder for you to understand rather than be of any help.
@vamship (132)
• India
25 Dec 10
hi jeeyah,
although i may not a expert but i try to resolve your problem
but the given way its not possible
but it can be displayed in the following way
12345=one thousand three hundred four tens five
if this is one of the way you want output i will you give you the code here.....
cheeers.
dont forget to ask ur C problems anytime