The decoding of a natural number
is a string of characters such that every two digits of
represent a character. For example, the decoding of
is AD, because the ASCII code of the character
A is 65 and the ASCII character of the character
D is 68. Notice that
has two groups of two digits:
and
.
Another example: the decoding of
is ABCD, since
is composed of
,
,
,
and
.
It is necessary to implement the recursive function
void decodificacio(int) with the following
specification:
PRE: The input is an integer
such that:
.
is even
for any pair of digits ( odd) we have that .
POST: writes the decoding of
to the output channel cout.
Only recursive solutions are accepted.
IMPORTANT: You only need to submit the requested
function, and possibly other necessary actions and functions. However,
you must keep the type definitions and #includes.
The input consists of a natural number such that is even and for any pair of digits such that is odd, we have that .
For each integer , its decoding.
decodificacio(65666768) => "ABCD" decodificacio(6568) => "AD" decodificacio(676665) => "CBA" decodificacio(88) => "X"