+ 1
How do I name a variable using a function parameter?
So I am making a game and everything is made out of shapes so I made a function for that you need to name a variable for it to be valid (In sfml an object is a variable.) It needs a name so I made a parameter that is for the naming. that doesn't work what do I do now?
4 Réponses
+ 1
I got it. Thanks.
+ 4
You should show us the code, otherwise we would have to guess what might be the problem.
+ 1
Is it possible to name variables using function parameters? That was the question
+ 1
The function parameters have names already.
Or do you mean, you want to pass in strings that are supposed to be referenced in the function like variable names would?
If you showed us your code, someone might come up with a less complicated way to accomplish what you want to do.
If you leave me guessing, a mapping type sounds like it might do what you want.
Read up on it here:
https://www.moderncplusplus.com/map/