View Full Version : Need help with variable names...

05-31-2009, 04:23 PM
I need to know how to do the following in C++:
Lets say I hat like 10 variables which all have similar names like this:
number0, number1, number2, number3.....number9

I want assign values to all of these variables at a certain time in a program but don't feel like typing all of the names and would rather use a for loop:
for( int i = 0; i < 10; i++ )
"number + i" = i;

something like that...I know how to do this in actionscript, but it doesn't seem to be working here...any tips on how I can do this?

05-31-2009, 06:14 PM
I'm not sure it's possible, at least, I haven't heard of it, or been able to find a way... You could try using an array instead like this:

int number[10];
for( int i = 0; i < 10; i++ ) {
number[i] = i;

EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum