Skip to main content
gamedev.net
🔒 Locked

Dumb questionn

Started by Andre the Giant Aug 14, 2002 at 7:47 PM 1 replies 250+ views
Original Post
Andre the Giant
Andre the Giant
Is there an ''excepted'' way to convert a number to a string? for example, this code does not do what I want it to: string s[10]; for (int i = 1; i < 10; i++){ s = "number " + i; } instead of making the s array like this: number 1 number 2 number 3 ... It does something wierd like this: umber mber ber (Im not sure thats exactly what happens, but something similar - im at work right now and cant remember exactly) I know I could use the itoa() function, but people discourage the use of that function and i dont know why. Also, I know of the sprintf() function which is ugly but also works. I want to know what other people do when the need to do such things? Its not my fault I''''m the biggest and the strongest; I don''''t even exercise.
Its not my fault I''m the biggest and the strongest; I don''t even exercise.
Shannon Barber
Shannon Barber
itoa in stdlib.h
sprintf in stdio.h
std::stringstream in sstream
The trade-off between price and quality does not exist in Japan. Rather, the idea that high quality brings on cost reduction is widely accepted.-- Tajima & Matsubara

Topic Locked

This topic has been locked by a moderator. New replies are not allowed.

Sign in to reply to this topic.