- #1
- 1,120
- 1
I'm just finishing off my C++ project and I decided when looking at two functions that they would be far more efficent as one function (because they are always used together and as it was it repeats the same code twice).
Now I wanted my output as an array so I could called on the two needed numbers.
So my test code went something like this:
CTenK split_power_two(CTenK number);
CTenK split_power_two(CTenK number)
{
CTenK Answer[2];
Answer[1]=One;
Answer[2]=Two;
return Answer[2];
}
Which didn't work at all of course and only returned Two. I've also tried thinks like:
CTenK[2] split_power_two(CTenK number);
CTenK[2] split_power_two(CTenK number)
{
CTenK Answer[2];
Answer[1]=One;
Answer[2]=Two;
return Answer[2];
}
And I get some horrible errors for that.
(Note CTenK us just a class we made up and are using)
Any help would be fantastic.
Now I wanted my output as an array so I could called on the two needed numbers.
So my test code went something like this:
CTenK split_power_two(CTenK number);
CTenK split_power_two(CTenK number)
{
CTenK Answer[2];
Answer[1]=One;
Answer[2]=Two;
return Answer[2];
}
Which didn't work at all of course and only returned Two. I've also tried thinks like:
CTenK[2] split_power_two(CTenK number);
CTenK[2] split_power_two(CTenK number)
{
CTenK Answer[2];
Answer[1]=One;
Answer[2]=Two;
return Answer[2];
}
And I get some horrible errors for that.
(Note CTenK us just a class we made up and are using)
Any help would be fantastic.