Get the App
SLTechnology News&Howtos  ›  Development  › 

How to realize a flashing Christmas tree in C language

Shulou Source: shulou.com Published: 2022-06-02 05:08:04 10月03日 Update

Editor to share with you how C language to achieve a flickering Christmas tree, I believe that most people do not know much about it, so share this article for your reference, I hope you will learn a lot after reading this article. Let's learn about it!

Effect picture

Fig. 1 Christmas tree

Let's take a look at the source code, as shown below:

# include # define N 15char str [] = {'*','','@','\',','$','','%','','&','','!'}; void color (int a) {SetConsoleTextAttribute (GetStdHandle (STD_OUTPUT_HANDLE), a) } void getCoord (double y, double x) {COORD pos = {xjingy}; SetConsoleCursorPosition (GetStdHandle (STD_OUTPUT_HANDLE), pos);} void hideCursor () {CONSOLE_CURSOR_INFO cursor= {1,0}; SetConsoleCursorInfo (GetStdHandle (STD_OUTPUT_HANDLE), & cursor);} void layer (int x, int y, int num, int col) {color (col); getCoord (xjie); int idx = rand ()% N Printf ("% c", str [idx]); for (int k = 1; k

Tags: Functions Christmas trees articles output language location content principles colors triangles less constant cursors coordinates most characters hierarchies effects effects more Apple Docker Huawei Linux macOS MariaDB Microsoft MySQL NVidia OPPO Reno Xiaomi Shulou Technology MySQL macOS Linux