Please help me check this!!

I don't know why, it doesn't print out the pattern when I run this code.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
#include <iostream>
#include <string>

using namespace std;

int main()
{
    char Christmastree [30][30] = {"   ☆",
                                    "a/~~\a",
                                   "a/****\a",
                                  "a/~J~~ ⃝\a",
                                 "a/********\a",
                                "a/~~ ⃝~~J~~~\a",
                               "a/*******J****\a",
                              "a/~J~~~~~~~ ⃝~~~\a",
                             "a/*****J**********\a",
                            "a/~ ⃝~~~~~~ ⃝~~J~~~\a",
                                   "|    |",
                                   "|    |",
                                   "|    |"};


    string name;
    cout << "What's your name?\n";
    getline(cin, name);
    cout << Christmastree << "\n" << "Merry Christmas!" << name << "!\n" << endl;
}
it doesn't print out the pattern when I run this code.

I don't know why you think it would.

You're feeding std::cout the address of an array of a type that it isn't specialized for, so it just prints the address you're feeding it.

If it did magically know what you meant to happen, the resultant output wouldn't look much like a christmas tree:

http://ideone.com/WtzQan
You don't have to use raw strings, simply something like this would suffice:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
string x=     "          /\\\n"
              "        a/~~\\a\n"
              "       a/****\\a\n"
              "      a/~J~~o~\\a\n"
              "     a/********\\a\n"
              "    a/~~o~~J~~~~\\a\n"
              "   a/*******J****\\a\n"
              "  a/~J~~~~~~~o~~~~\\a\n"
              " a/*****J**********\\a\n"
              "a/~o~~~~~~o~~J~~~~~~\\a\n"
              "       |    |\n"
              "       |    |\n"
              "       |    |\n";
cout << x;
Topic archived. No new replies allowed.