using an if statement to choose type to declare a variable C++
<p>I am referencing a variable for use in a function and there are times it might be an int and times it might be a float. I have figured out a way to automatically tell which type I want the variable to be (either an int or a float) but I want a way to declare that variable so that when it is referenced later it will be the correct type. I know that you can cast one type of variable into another but it seems that it requires a new variable to be introduced. </p>

<p>Any thoughts?</p>
