Hi All!
I've got a weird problem here...It doesn't want to add my int values to a char array even though I static_cast the value to char.
If you could just look at my code please!
void AltBoolean::print(){
perma = new char[arraySize];
int temp;
int counter = 1;
for(int i = 0 ; i < arraySize ;i++)
{
if(ChoiceArray[i] == 0)
{
perm[i] = ArrOperator[i];
}
else if(ChoiceArray[i] == 1) //it doesn't go into this part of the function it seems!
{
cout << "this doesn't even print" << endl;
temp = ArrOperand[counter];
static_cast<char>(temp);
perm[i] = temp;
counter++;
}
}
for (int d=0; d<arraySize; d++)
cout << ArrOperator[d];
for (int e=1; e<arraySize; e++)
cout << ArrOperand[e];
for (int r=0; r<arraySize; r++)
cout << perma[r];
}
Declared the array's as follow:
bool *ChoiceArray;
int *ArrOperand;
char *ArrOperator;
char *perm;
The above is initialized correctly! and I checked for that...think its something with the static cast/converting area.
my arraySize is 3 here and the bottom for-loop for the ArrOperator and ArrOperand prints fine! but in the perma arr it doesn't print the ArrOperand part!
Also in my ChoiceArray it only consists of 0's and 1's!
Any help will be appreciated...thanks !