Voila j'ai le code suivant:
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
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
#include <stdio.h>
#include <stdlib.h>
#include <time.h>
#include <windows.h>
#include <conio.h>
#include <mmsystem.h>
#define TX 80
#define TY 50

char Laby_aff[TX][TY][2];

//-----------------------------------------------------------------------------  
void Ecran(int Mode) // parametre Mode : 1=plein ecran et 2=mode fenetre
{
     typedef BOOL WINAPI (*SetConsoleDisplayModeT)(HANDLE,DWORD,DWORD*);
     SetConsoleDisplayModeT SetConsoleDisplayMode;
  
    HINSTANCE hLib=LoadLibrary("KERNEL32.DLL");
    SetConsoleDisplayMode=(SetConsoleDisplayModeT)
       GetProcAddress(hLib,"SetConsoleDisplayMode");
  
    HANDLE h=CreateFile("CONOUT$",GENERIC_WRITE|GENERIC_READ,FILE_SHARE_READ |
       FILE_SHARE_WRITE,NULL,OPEN_EXISTING,0,0);
  
    DWORD oldmode;
  
    SetConsoleDisplayMode(h,Mode,&oldmode);
}
//-----------------------------------------------------------------------------

void position(int x,int y)
{
     HANDLE handle=GetStdHandle(STD_OUTPUT_HANDLE);
     COORD pos={x,y};
     SetConsoleCursorPosition(handle,pos); 
}

void aff(int x,int y,char c)
{
     position(x,y);
     printf("%c",c);
     position(x,y);     
}
void ecrire(int x,int y)
{
     int r,i,j;
     if (Laby_aff[x][y][1])
     {
        for (i=(x-1);i>=(x+1);i++)
            for (j=(y-1);j>=(y+1);j++)
            {
                system("pause");
                r=rand()%10;
                if (r==0||r==1||r==2) aff(i,j,'|');
                if (r==3||r==4||r==5) aff(i,j,' ');
                if (r==7||r==8||r==9) aff(i,j,196);
                system("pause");
            }
     }
}
int main(int argc, char *argv[])
{
  
  int i,j,x=0,y=0,r,c;
  Ecran(1);
  for (i=0;i<TX;i++)
      for (j=0;j<TY;j++)
          {Laby_aff[i][j][0]=' ';
           Laby_aff[i][j][1]=32;}
  srand((unsigned)time(NULL));
  for (y=0;y<TY;y++)
            aff(1,y,'|');
  aff(3,1,'|');
  x=2;
  y=1;
  while (1)
  {
        
        
        //Sleep(1000);
        
        c=getch();
        aff(x,y,' ');
        if (c==224) c=getch();
        if (c==77) x++;
        if (c==75) x--;
        if (c==80) y++;
        if (c==72) y--;
        if (c==27) exit(0);
        aff(x,y,'*');  
        ecrire(x,y);      
        
        
        
        
        
        
  }  
  
  
  
  
  system("PAUSE");    
  return 0;
}
Le probleme est que je n'ait aucun affichage de "gras"!
Je ne comprend pas pourquoi!!