티스토리 뷰

C++로 구현한 크리스마스 트리

 

#include <iostream>
using namespace std;

#define width 15
#define height 15

int main()
{
    cout << "\n***   Merry Chritsmas   ***\n\n";

    for (int a = 0; a < width - 1; a++)
    {
        cout << " ";
    }
    cout << "@\n";

    for (int i = 1; i <= height; i++)
    {
        for (int j = 0; j < width - i; j++)
        {
            cout << " ";
        }
        for (int a = 0; a < i; a++)
        {
            cout << "*";
        }

        for (int b = 0; b < i - 1; b++)
        {
            cout << "*";
        }

        cout << "\n";
    } // 이파리
    for (int a = 0; a < width - 2; a++)
        cout << " ";
    cout << "|||\n"; // 기둥
}

.

.

.

 

'프로그래밍 > C,C++' 카테고리의 다른 글

정수형을 문자열로 C++  (0) 2022.07.10
vector C++ STL(Standard Template Library)  (0) 2022.07.09
int main(int argc, char* argv[])  (0) 2019.09.14
문자열 인코딩 개념정리  (0) 2019.09.14
C++ 라이브러리 추가 전처리기  (0) 2019.07.29
공지사항
최근에 올라온 글
최근에 달린 댓글
Total
Today
Yesterday
링크
«   2025/08   »
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 29 30
31
글 보관함