08-27-2011, 08:46 PM
[B]Create new variables with a loop? in c++ 2011 -12
int my_var_1 = 1;
int my_var_2 = 1;
int my_var_3 = 1;
Because the user may need thousands of variables, and I don't want there to be a limit. So I was wondering if there was a way to declare variables with a loop appending a number to the end of the name.
Something like the following:
for(int i=1; i<3; i++) {
int my_var_ + i = 1;
}[/B]
int my_var_1 = 1;
int my_var_2 = 1;
int my_var_3 = 1;
Because the user may need thousands of variables, and I don't want there to be a limit. So I was wondering if there was a way to declare variables with a loop appending a number to the end of the name.
Something like the following:
for(int i=1; i<3; i++) {
int my_var_ + i = 1;
}[/B]
0300-9520262
Get solution in 24 hour |cpmputer & internet
mileys81:[SIZE="4"][SIZE="3"]....[/SIZE][/SIZE]
