Beginner cout question

In response to an exercise that asked for a program to print "HELLO" in big block letters where each letter is 7 characters high and 5 characters wide, I coded:

1
2
3
4
5
6
7
8
9
10
11
12
#include <iostream>

int main()
    std::cout << "*   * ***** *     *     *****" << "\n";
    std::cout << "*   * *     *     *     *   *" << "\n";
    std::cout << "*   * *     *     *     *   *" << "\n";
    std::cout << "***** ****  *     *     *   *" << "\n";
    std::cout << "*   * *     *     *     *   *" << "\n";
    std::cout << "*   * *     *     *     *   *" << "\n";
    std::cout << "*   * ***** ***** ***** *****" << "\n";
    return (0);
}


It compiled and returned the desired effect, however, I'm wondering if there was a simpler or less redundant method to code this...
You can "chain" the std::couts together like so:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
#include <iostream>

int main()
    //no ';' on the end, so that the << works correctly
    //the compiler doesn't care about extra enters or spaces
    std::cout << "*   * ***** *     *     *****" << "\n"
              << "*   * *     *     *     *   *" << "\n"
              << "*   * *     *     *     *   *" << "\n"
              << "***** ****  *     *     *   *" << "\n"
              << "*   * *     *     *     *   *" << "\n"
              << "*   * *     *     *     *   *" << "\n"
              << "*   * ***** ***** ***** *****" << "\n";
    return (0);
}
Thanks! Exactly what I was looking for.
Topic archived. No new replies allowed.