voici mon code il y a un problème c'est que pour passe du choix avec les touche directionnelle a la saisie de nom et autre je dois appuyer 2 fois sur entrer des fois plus je veux savoir a quoi est du ce problème est qu'elle est la solution


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
#include <stdio.h>
#include<conio.h>
 
int x=0;
typedef struct adherents
{
	long num_adh;
	char nom[21];
	char prenom[21];
	char adresse[151];
	long tel;
	char categorie;
}adh;
 
char choix_categorie()
{
int i,y;
char mn[3][20]={"Etudiant","Prof","Administrateur"};
for (i=0; i<3;i++)
{
	if (i==x)
		textbackground(6);
	gotoxy(30,6+i);
	cprintf("%s\n",mn[i]);
	textbackground(9);
}
do
{
	y=getch();
	if (y==0)
		y=getch();
	switch (y)
	{
		case 80:if (x<2)
				x+=1;
			else
				x=0;
			choix_categorie();break;
		case 72:if (x==0)
				x=2;
			else
				x-=1;
			choix_categorie();break;
		case 13:
			switch (x+1)
			{
				case 1:return ('E');
				case 2:return ('P');
				case 3:return ('D');
			}
	}
}
while (!0);
}
 
void ajout_adh(adh *adh)
{
clrscr();
gotoxy(30,2);cprintf("Saisie d'un adherent");
gotoxy(5,6);printf("choix categorie    :");
gotoxy(5,10);printf("donner Nø adh      :");
gotoxy(5,12);printf("donner le nom      :");
gotoxy(5,14);printf("donner le prenom   :");
gotoxy(5,16);printf("donner l'adresse   :");
gotoxy(5,18);printf("donner le Nøde tel :");
gotoxy(30,6);adh->categorie=choix_categorie();
gotoxy(30,10);scanf("%ld",adh->num_adh);flushall();
gotoxy(30,12);gets(adh->nom);
gotoxy(30,14);gets(adh->prenom);
gotoxy(30,16);gets(adh->adresse);
gotoxy(30,18);scanf("%ld",adh->tel);
}
 
void main()
{
adh *adh;
     ajout_adh(adh);
     getch();
}