Is there any way we could convert the given number are as the character array?? either it may be a floating point and integer. This should be done without using any kind of built in string functions.. Any suggestion guys?
this needs a good answer mates :).. do help it out to find that ...
mm this one i dont know a good anwser i have allways use functions built one. From number to string, just use mod / 10 and get digits one by one an build the string From string to number do the inverse, if its an integer, supose its d0d1d2...dn a digit of size n. So u gotta do number = d0*10^n-1 + d1*d1^n-1 + ... + dn. U just need a funtion or array that maps u a single character to a num. "9" to 9, "8" to 8 and so on. If its a float well u just do the same for the natural part, and do the same procedure for the decimal. For example d0d1...dn.dc0dc1...dcm number = d0*10^n-1 + d1*d1^n-1 + ... + dn + dc0*10^-1 + dc1*10^-2 + .... + dc*10^-(m+1). If its negative u just gotta do number = -number. U can do this easy with a graph, like an automaton, like the ones u use in regular expression.
@fedep3 thanks for the reply, but I am more concerned with float to string, like we do a mod 10 this will surely work for the integer. but the floating point number, is there any way??
fmod, remember alchemista told it too u in another question, i think
@fedep3 ya ya I do remember that... will try tht...
Join our real-time social learning platform and learn together with your friends!