Hello,
Voila, j'essaie de créer un petit programme permetant de calculer l'IMC d'une personne, mais voila, lors de l'execution, le programme me renvoie des resultat de type -265120715...
le programme va lire une structure dans un fichier, et fait le calcul via 2 resultats recupéré.
je vous met une partit de mon code :

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
148
149
150
151
152
153
154
155
156
157
158
#include <stdio.h>
#include <stdlib.h>
 
#define NOM 30
#define PRENOM 30
#define DATE_NAISSANCE 10
#define NIVEAU 30
#define CONTACT 10
 
typedef struct 
{
	char Nom[NOM];
	char Prenom[PRENOM];
	char DateNaissance[DATE_NAISSANCE];
	double Poids;
	double Taille;
	char Niveau[NIVEAU];
	int Contact[CONTACT];
} Adherent;
 
 
int main()
{
	return menuChoix();
}
 
int menuAdherent()
{
	int choix = 0, sortie = 0;
 
	while (sortie == 0 && choix>1 || choix<8)
	{
		/*effacer ecran*/
		system ("CLS");
		printf("--- Gestion des Adherents---\n\n");
		printf("1) Creer nouvel Adherent\n");
		printf("7) Calcul de L'IMC\n");
		printf("8) Menu Principal\n\n");
		printf("Veuillez faire un choix : \n\n");
		scanf("%ld",&choix);
 
		switch(choix)
		{
			case 1:
				adherentNew();
				break;
			case 7:
				calculIMC();
				break;
			case 8:
				sortie = 1;
				break;
		}
	}
}
 
//Adherent
int adherentNew()//1) Ajouter un adherent
{
	FILE* fichier = NULL;
	Adherent Adherent;
 
	/*Effacer ecran*/
	system("CLS");
 
	/*Titre*/
	printf("-----Nouvel Adherent-----\n");
 
	/*Saisie*/
	printf("\nNom : ");
	scanf("%s",&Adherent.Nom);
	printf("\nPrenom : ");
	scanf("%s",&Adherent.Prenom);
	printf("\nDate de Naissance(JJMMAAAA) : ");
	scanf("%s",&Adherent.DateNaissance);
		printf("\nPoids (en Kilo) : ");
	scanf("%d",&Adherent.Poids);
		printf("\ntaille (en Cm) : ");
	scanf("%d",&Adherent.Taille);
		printf("\nNiveau (Debutant, Moyen, Bon, Expert): ");
	scanf("%s",&Adherent.Niveau);
		printf("\nTelephone : ");
	scanf("%d",&Adherent.Contact);
 
 
	/*Enregistrement*/
	fichier=fopen("FichierAdherent.txt","a");
	if (fichier != NULL)
	{
		fprintf(fichier,"%s\n", Adherent.Nom);
		fprintf(fichier,"%s\n", Adherent.Prenom);
		fprintf(fichier,"%s\n", Adherent.DateNaissance);
		fprintf(fichier,"%d\n", Adherent.Poids);
		fprintf(fichier,"%d\n", Adherent.Taille);
		fprintf(fichier,"%s\n", Adherent.Niveau);
		fprintf(fichier,"%d\n\n", Adherent.Contact);
 
		fclose(fichier);
		printf("\nEnregistrement effectue avec succes\n");
	}
	else
	{
		printf("\nImpossible d'ouvrir le fichier\n");
		getchar();
	}
 
	system("PAUSE");
 
}
 
 
int calculIMC()
{
	FILE* fichier = NULL;
	Adherent Adherent;
	int retour = 1;
	double indice =0;
	double NewTaille, NewPoids;
	/*Effacer ecran*/
	system("CLS");
 
	/*Recuperation des données*/
	fichier = fopen("FichierAdherent.txt", "r");		        
 
		if (fichier != NULL)			
		{	
			//faire une boucle qui lit le fichier source 
			//et ecrit dans la cible la fiche avec eventuellement 
			//les modifications (qui n'ecrit pas si la fiche est supprime)
			retour = fscanf(fichier, "%s\n%s\n%s\n%d\n%d\n%s\n%d\n\n",
					&Adherent.Nom, &Adherent.Prenom, &Adherent.DateNaissance, &Adherent.Poids, &Adherent.Taille, &Adherent.Niveau, &Adherent.Contact);
			while (retour != EOF)				
			{			    
				NewPoids=Adherent.Poids;
				NewTaille=Adherent.Taille;
 
				indice = NewPoids / (NewTaille*NewTaille*0.001);
					printf("%d\n", indice);
 
				retour = fscanf(fichier, "%s\n%s\n%s\n%d\n%d\n%s\n%d\n\n",
					&Adherent.Nom, &Adherent.Prenom, &Adherent.DateNaissance, &Adherent.Poids, &Adherent.Taille, &Adherent.Niveau, &Adherent.Contact);
 
			} 
 
			//fermer les fichiers
			fclose(fichier);				
		}        
 
	else        
	{           
		printf("\nImpossible d'ouvrir le fichier");            
		getchar();            
	}
 
 
	system("PAUSE");
 
}
Si quelqu'un aurait une solution/conceil qu'il n'hesite pas
merci