將一串數字轉換成字串

題目是
Write a program that converts a sequence of bits into messages (this process is known as decoding, and the reverse process is called encoding). There are five types of bit encoding: 00, 01, 100, 1010, 1011. The corresponding message for each bit encoding is shown below.

00 -> Happy

01 -> Surprise

100 -> Fear

1010 -> Anger

1011 -> Sad
呈現出來的效果得是這樣的
Enter a sequence of bits: 10000101001001011

Fear Happy Anger Surprise Happy Sad
下邊是我寫的一直輸出不了 想請問怎麼處理




```#include 
using namespace std;
char n, i;
char *array = new char [n];
int main()
{

    cout<<"Enter a sequence of bits: ";

    cin >> array ;
    cout<< array[0] <array[1] <array[2] <array[3] <if(array[0]==1)
            {
                    if(array[1]==0)
                    {
                        if(array[2]==0)
                        {
                            cout << "Fear" << endl;
                        }
                        if(array[2]==1)

                        {
                            if(array[3]==0)
                            {
                                cout << "Anger" << endl;
                            }
                            if(array[3]==1)
                            {
                                cout << "Sad" << endl;
                            }
                        }
                    }
            }

            if(array[0]==0)
            {
                    if(array[1]==0)
                    {
                        cout << "Happy" << endl;
                    }
                    if(array[1]==1)
                    {
                        cout << "Surprise" << endl;
                    }

            }

    delete [] array; 
    return 0;
} 
```c++