I've been having a problem with this code. I don't know why. It's supposed to read a series of numbers (like 12345678 in this example), and depending on what numbers are in the sequence, it outputs code. Why won't this work?
Code:
string CurrentOutputNums = "12345678";
string outputContents = "";
for(unsigned int c = 0; c < CurrentOutputNums.length(); c++)
{
if(&CurrentOutputNums.substr(c,1) == "1")
{ outputContents += "\n\n (cue\n (mult (sine pitch duration) (env 0.0 0.0 0.0 1.0 1.0 1.0 duration))\n )"; continue; }
if(&CurrentOutputNums.substr(c,1) == "2")
{ outputContents += "\n\n (cue\n (mult (sine pitch duration) (env 0.0 0.0 0.0 2.0 2.0 2.0 duration))\n )"; continue; }
if(&CurrentOutputNums.substr(c,1) == "3")
{ outputContents += "\n\n (cue\n (mult (sine pitch duration) (env 0.0 0.0 0.0 3.0 3.0 3.0 duration))\n )"; continue; }
if(&CurrentOutputNums.substr(c,1) == "4")
{ outputContents += "\n\n (cue\n (mult (sine pitch duration) (env 0.0 0.0 0.0 4.0 4.0 4.0 duration))\n )"; continue; }
if(&CurrentOutputNums.substr(c,1) == "5")
{ outputContents += "\n\n (cue\n (mult (sine pitch duration) (env 0.0 0.0 0.0 5.0 5.0 5.0 duration))\n )"; continue; }
if(&CurrentOutputNums.substr(c,1) == "6")
{ outputContents += "\n\n (cue\n (mult (sine pitch duration) (env 0.0 0.0 0.0 6.0 6.0 6.0 duration))\n )"; continue; }
if(&CurrentOutputNums.substr(c,1) == "7")
{ outputContents += "\n\n (cue\n (mult (sine pitch duration) (env 0.0 0.0 0.0 7.0 7.0 7.0 duration))\n )"; continue; }
if(&CurrentOutputNums.substr(c,1) == "8")
{ outputContents += "\n\n (cue\n (mult (sine pitch duration) (env 0.0 0.0 0.0 8.0 8.0 8.0 duration))\n )"; continue; }
}
This is just a fragment of the code. This part is the only part that doesn't work. It outputs the outputContents string to a file later in the code.