|
![]() |
Overclock.net - Overclocking.net > Software, Programming and Coding > Coding and Programming > Application Programming | |
Simple C++ question, is this possible?
|
||
![]() |
|
|
LinkBack | Thread Tools |
|
|
#1 (permalink) | ||||||||||||
|
Audiophile
![]() |
So I can type
__________________int a1 = 1; int b1 = 1; and so on... Is it possible to have a loop that would create as many ints (or any other type) with custom labels? Something like... int x = 0; string str; while ( x < y) { str = function_that_appends_x's_value_to_letter(x); int "str" = 0; //this is my main question, I know this wouldn't compile. x++; } I feel like the answer is staring me in the face using dynamic arrays, pointers, or something OR there would never be a real use for such a thing. I'm trying to make a puzzle of sorts, and having this functionality would make the code more "fun" to read.
|
||||||||||||
|
|
|
|
|
#2 (permalink) | |||||||||||||
|
With great difficulty
![]() |
You want to use a map, where you can map a string identifier to an int value
__________________
|
|||||||||||||
|
|
|
|
#3 (permalink) | ||||||||||||
|
Audiophile
![]() |
Great, thanks for the help. It's difficult to google such things.
__________________
|
||||||||||||
|
|
|
![]() |
| Currently Active Users Viewing This Thread: 1 (0 members and 1 guests) | |
| Thread Tools | |
|
|