first of all greeting to every one
i want to convert integer value into digits
input into any variable x=234678
store in array y[8] that y[0]=2,y[1]=3 and so on.
how can i do that
in c++

i got error with that lib. i am using tc300
but i used char array and conv it into integer through atoi

atoi() converts a null terminated char array into an integer value (strtox() functions may be a better choice for this) rather than convert an integer value into a null terminated char array. The three options I'm aware of to turn integers into null terminated char array include:

1) sprintf(), as per Narue's post. tc300 may not be up to date, in which case your options would be:
a) replace your compiler with one more up to date (there are several good, free compilers
b) replace #include <cstdio> with #include <stdio> and drop the std:: notation before sprintf()

2) use stringstreams if you want C++ syntax rather than C syntax

3) use non-standard itoa() if your compiler has it. Given it is non-standard this is the least recommended option, but you have to do what you gotta do, so use it if you have to (you shouldn't have to though!)

yep but ihave to give assignment by tomarrow 4 programs and i am afraid to change compiler cause of sytax changes
how can i give
auto increament in space in each out put display


and add resultant outputs (in arays )to
get result shown
for defined inputs its easy but where lines increased arrays also goes up
any simpler way

its not nice to post the same question in two different threads. you will probably get mixed results and possibly conflicting answers. The answer I posted at the bottom of your other thread should work with your compiler.

you will have to use


Narue gave you an answer for a more modern compiler.

i just using forum first time and i thought that
quick reply mean online contact
i got it

This article has been dead for over six months. Start a new discussion instead.