I have to ask: did your lectures already conver
recursion? Because if it did, then that is the only way I can think of how to do this
without a loop.
If it didn't, then I think the constraints you posted are not entirely correct, since any special function or syntax that you could use would involve an
internal loop at the very least.
Here's a rough outline in pseudo code for a recursive approach:
string convert_char_to_bin(char octal_char)
{
}
string remove_first(string my_string)
{
}
string convert_octal_to_binary(string octals) {
return octals.empty() ? "" : convert_char_to_bin(octals[0] + convert_octal_to_binary(remove_first(octals);
}
Technically this would fulfil the conditions, although using the '?' ternary operator may not have been something your tutor wanted to see either.