Bonjour,

Joyeux Noël

Code : Sélectionner tout - Visualiser dans une fenêtre à part
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
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
 
/* Sapin de Noël sous linux
 * 2019.12.23
*/
 
#include <stdio.h>
#include <stdlib.h>
#include <time.h>
#include <string.h>
#include <unistd.h>  // sleep(secondes) et usleep(microsecondes)
#include <ctype.h>   // pour la fonction toupper() qui transforme les lettres en majuscules, l'inverse tolower()
#include <dirent.h>
 
#define CLEAR system("clear||cls");
#define RESET_COLOR "\x1B[0m"
 
int main()
{
    printf("\n          \033[5;31mX " RESET_COLOR); // étoile rouge clignotante
 
    printf("\n          \033[0;32m| ");             // sapin en vert fixe
    printf("\n         / \\ ");
    printf("\n        /   \\ ");
 
    printf("\033[5;33mO" RESET_COLOR);              // boule jaune clignotante
 
    printf("\n       \033[0;32m/     \\ ");         // sapin en vert fixe
 
    printf("\n     \033[5;31mO" RESET_COLOR);       // boule rouge clignotante
 
    printf("\033[0;32m/       \\ ");                 // sapin en vert fixe
 
    printf("\n     /    \033[5;35m O ");            // boule magenta clignotante
 
    printf("  \033[0;32m\\");                       // sapin en vert fixe
    printf("\n    /___________\\ " RESET_COLOR);
 
    printf("\n          ||     ");
    printf("\033[5;34mO           " RESET_COLOR);   // boule bleue clignotante
 
    printf("\n    _V_   ||      _V_ ");
    printf("\n    |_|   ||      |_| ");
 
    printf("\n\n");
 
    sleep(3);
    printf("      \033[5;31mJoyeux Noël " RESET_COLOR);
 
    printf("\n\n");
    sleep(6);
 
    return EXIT_SUCCESS;
}
Ci-dessus un sapin de Noël animé sous linux, c'est de saison.

Comment réaliser le texte ci-dessous en console sous windows?
Pour ensuite réaliser le sapin de Noël animé :-)

Code : Sélectionner tout - Visualiser dans une fenêtre à part
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
32
33
34
35
36
37
38
 
/* Texte animé sous linux
 * le terminal est sur fond blanc avec Qt
*/
 
#include <stdio.h>
#include <stdlib.h>
 
# define RESET_COLOR "\x1B[0m"
 
int main()
{
    printf("\033[0;30m"); // texte en noir
    printf("\n Le texte en couleurs sous linux : \n");
 
    printf("\033[0;31m"); // texte en rouge
    printf("\n Texte 0 en rouge" RESET_COLOR " puis en noir. \n");
 
    printf("\033[1;31m"); // texte en rouge
    printf("\n Texte 1 en rouge" RESET_COLOR " puis en noir. \n");
 
    printf("\033[4;31m"); // texte en rouge souligné
    printf("\n Texte 4 en rouge" RESET_COLOR " puis en noir. \n");
 
    printf("\033[5;31m"); // texte en rouge clignotant
    printf("\n Texte 5 en rouge" RESET_COLOR " puis en noir. \n");
 
    printf("\033[7;31m"); // texte en rouge surligné
    printf("\n Texte 7 en rouge" RESET_COLOR " puis en noir. \n");
 
    printf("\033[9;31m"); // texte en rouge barré
    printf("\n Texte 9 en rouge" RESET_COLOR " puis en noir. \n");
 
    printf("\033[0;32m"); // texte en vert
    printf("\n Texte 1 en vert" RESET_COLOR " puis en noir. \n");
 
    return 0;
}
Je n'y parviens pas sous windows, cela permettrait d' égailler, d'ajouter quelques animations dans la console sous windows.

Vous remerciant par avance pour vos lumières,

Bonnes fêtes à vous.