Bonjour à tous,

Pour améliorer la présentation de mon projet , mon professeur m'a donné un code pour faire un menu déroulant ( ou dynamique, appelez ça comme vous voulez ).

Voici le code qu'il nous a donné :
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
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
int main(void)
{
    ecran(1);
    interfacedebut();
    getch();
}
 
void ecran(int Mode)  /*parametre Mode : 1=plein ecran et 2=mode fen?tre*/
{
    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 cadre(int debutcol,int debutlig, int nbrcol, int nbrlig, int nbrk)
{
    int i,j,k;
    gotoxy(debutcol,debutlig);
    printf("%c",201);
 
    for(i=0; i<nbrcol-1; i++)
    {
        printf("%c",205);
    }
    printf("%c",187);
 
    k=nbrlig+nbrk;
 
    for(i=0; i<nbrlig-1; i++)
    {
        gotoxy(debutcol,k);
        printf("%c",186);
 
        for(j=0; j<nbrcol-1; j++)
        {
            printf(" ");
        }
        printf("%c",186);
        k++;
    }
 
    gotoxy(debutcol,k);
    printf("%c",200);
    //gotoxy(debutcol,k);
    for(i=0; i<nbrcol-1; i++)
    {
        printf("%c",205);
    }
    printf("%c",188);
}
 
 
void interfacedebut()
{
    int flag=0,x,i,posgotoxy1[5]= {36,36,36,36,36},posgotoxy2[5]= {12,15,18,21,24},poscadre[5]= {11,14,17,20,23},k[5]= {10,13,16,19,22};
    char tab[5][30]= {"Films dispos","tarifs","sorties","modifier ","QUITTER"};
 
    do
    {
        //menudemarrer();
        for(i=0; i<5; i++)
        {
            cadre(30,poscadre[i],18,2,k[i]);
            gotoxy(posgotoxy1[i],posgotoxy2[i]);
            textcolor(WHITE);
            cprintf("%s",tab[i]);
        }
        i=0;
 
        do
        {
            cadre(30,poscadre[i],18,2,k[i]);
            gotoxy(posgotoxy1[i],posgotoxy2[i]);
            //highvideo();
            printf("%s",tab[i]);
            normvideo();
            x=getch();
            if(x==224)
            {
                x=getch();
                if(x==KEY_DOWN)
                {
                    cadre(30,poscadre[i],18,2,k[i]);
                    gotoxy(posgotoxy1[i],posgotoxy2[i]);
                    textcolor(CYAN);
                    highvideo();
                    cprintf("%s", tab[i]);//
                    i++;
                    if(i==5)
                        i=0;
                }
                if(x==KEY_UP)
                {
                    cadre(30,poscadre[i],18,2,k[i]);
                    gotoxy(posgotoxy1[i],posgotoxy2[i]);
                    textcolor(CYAN);//highvideo();
                    cprintf("%s",tab[i]);
                    i--;
                    if(i==-1) i=4;
                }
            }
        }
        while(x!=13);
 
        if(x==13)
        {
            switch (i+1)
            {
            case 1:
                system("cls");
                flag=1;
                affiche();
                break;
            case 2:
                system("cls");
                flag=1;
                tarif();
                break;
            case 3:
                system("cls");
                flag=1;
                sorties();
                break;
            case 4:
                system("cls");
                flag=1;
                admin();
                break;
            case 5:
                system("cls");
                menu();
                break;
            }
        }
 
        clrscr();
    }
    while(i!=4);
}

Ceci est donc un code purement donné par le prof, nous ne l'avons pas vu en classe.

Ma question est la suivante : Comment faire pour rajouter des "cases" pour le menu , car en effet je suis bloqué à maximum 5 cases et aucune idée de comment en ajouter...

Si quelqu'un pouvait me l'expliquer, je lui en serais très reconnaissant.

Merci d'avance et bonne journée.