Okay my problem is that I want to run a for loop that multiples the variable in the for loop by a number but that part of my code has to be within a string for the program I am running it in. So my question is is how do I declare this variable within that string in order to make the math work?
This is part of the code
for(int i=0;i<=5;i++)
{
T->Draw("g_p[0]-r_p[0]>>h1(100,-.07,.1)","r_FT[0]==1 && g_p[0]<1.35+.25 && g_p[0]>1.35-.25 && g_theta[0]<(0.0396+0.0792*i)+0.0396 && g_theta[0]>(0.0396+0.0792*i)-0.0396");
}
What i need is the variable I to be seen as a variable and change to numbers 0-5 for the 6 different times this code should be run
Convert first integer i to a string, hen use string concatenation methods. There is no direct way to do it as in interpreted languages like php, perl, etc.
So, sou need the string to command cast? One very, very, VERY stupid way is to change the file you are working on using file streams, becouse when you put a string in a file using file streams it will be a command, not a string. The only down-side i s that you would have to run the program twice.