<<<Index>>>

Solution: function declarations (prototypes)



#include <iostream>
using std::cout;

// Function declarations
void print_b( int count );
void print_a( int count );
void print_n( int count );

// Function definitions
void print_b( int count )
{
    --count; // 6
    if ( count == 0 ) return;
    cout << "b";
    print_a( count );
}

void print_a( int count )
{
    --count; // 5 3 1
    if ( count == 0 ) return;
    cout << "a";
    print_n( count );
    return;
}

void print_n( int count )
{
    --count; // 4 2 0
    if ( count == 0 ) return;
    cout << "n";
    print_a( count );
    return;
}

int main( )
{
    // banana
    int count = 7;
    print_b( count );
    return 0;
}

<<<Index>>>