I m trying to find idea to change like from 1 to one and 2 to two and 3 three from 1 to 999 i m had an idea to do like a string with information etc ? but i want better idea so i dunno how to do it :S lolz.
MrNoob
24
Posting Whiz in Training
Recommended Answers
Jump to PostI've got to run but does this make sense now?
I'd recommend using one single buffer, and printing it when the entire string is built!Also note, the cases of { 20, 100 } can be handled wither way as the result is the same index!
Jump to PostDoes that make sense?
Post your entire code string[] and parser!
Jump to PostHere, this is untested but I've reworked your function.
You should examine how the hundred's are handled to add thousand handling!
char *string[]= { "zero","one","two","three","four","five","six","seven","eight","nine","ten","eleven","tweleve","thirteen","fourteen","fifteen", "sixten","seventeen","eighteen","nineteen", // 0...19 "twenty","thirty","fourty","fifty","sixty","seventy","eighty","ninety", // 20...27 "hundred", "thousand", "million" // 28...30 }; void ParseString(char *buffer1,char **buffer2,int n,int n2,int choice) { if(!choice) …
Jump to PostSo what I posted should theoretically handle 0 to 999
nine hundred ninety-nine0 to 9,999 isn't to hard either.
Above that you can handle with a resursion
nine hundred ninety-nine thousand nine hundred ninety-nine
Jump to PostYou are breaking down your number into its component parts then re-assembling the ASCII into a string.
There are many ways to write the same program.
All the $printf() functions return the length of bytes built.
i = printf()
i = sprintf()
i = fprintf()
i = vprintf()
…
All 36 Replies
wildgoose
420
Practically a Posting Shark
BestJewSinceJC
700
Posting Maven
wildgoose
420
Practically a Posting Shark
MrNoob
24
Posting Whiz in Training
wildgoose
420
Practically a Posting Shark
wildgoose
420
Practically a Posting Shark
MrNoob
24
Posting Whiz in Training
MrNoob
24
Posting Whiz in Training
wildgoose
420
Practically a Posting Shark
wildgoose
420
Practically a Posting Shark
MrNoob
24
Posting Whiz in Training
MrNoob
24
Posting Whiz in Training
wildgoose
420
Practically a Posting Shark
wildgoose
420
Practically a Posting Shark
wildgoose
420
Practically a Posting Shark
wildgoose
420
Practically a Posting Shark
wildgoose
420
Practically a Posting Shark
MrNoob
24
Posting Whiz in Training
MrNoob
24
Posting Whiz in Training
wildgoose
420
Practically a Posting Shark
MrNoob
24
Posting Whiz in Training
MrNoob
24
Posting Whiz in Training
MrNoob
24
Posting Whiz in Training
wildgoose
420
Practically a Posting Shark
wildgoose
420
Practically a Posting Shark
MrNoob
24
Posting Whiz in Training
MrNoob
24
Posting Whiz in Training
MrNoob
24
Posting Whiz in Training
wildgoose
420
Practically a Posting Shark
Be a part of the DaniWeb community
We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.