Suggestions immédiates et urgentes.
- Mettre les balises fixed ou cpp (boutons [Fixe] ou [C/C++]]
- Apprendre à configurer ton compilateur (gcc, je suppose) pour qu'il te dise la vérité (voir options ci-dessous)
- Expliquer et corriger tous les warnings (et pas à coup de cast, on est bien d'accord...)
Compilateur: Default compiler
Building Makefile: "D:\Dev-Cpp\ED\001\Makefile.win"
Exécution de make...
make.exe -f "D:\Dev-Cpp\ED\001\Makefile.win" all
gcc.exe -D__DEBUG__ -c main.c -o dexe/main.o -I"C:/DEV-CPP/include" -W -Wall -O2 -Id:/clib -DDBG_SYSALLOC -D__NO_CTYPE_INLINES -Wshadow -Wpointer-arith -Wcast-qual -Wcast-align -Wwrite-strings -Wconversion -Waggregate-return -Wstrict-prototypes -Wredundant-decls -Wnested-externs -Winline -g3
main.c:23: warning: declaration of `total' shadows a global declaration
main.c:22: warning: shadowed declaration is here
main.c:27: warning: declaration of `moyenne' shadows a global declaration
main.c:23: warning: shadowed declaration is here
main.c:45: warning: return type defaults to `int'
main.c: In function `main':
main.c:52: warning: unused variable `k'
main.c:53: warning: unused variable `l'
main.c:154: warning: control reaches end of non-void function
main.c: In function `total':
main.c:192: warning: declaration of `total' shadows a global declaration
main.c:190: warning: shadowed declaration is here
main.c: At top level:
main.c:204: warning: declaration of `total' shadows a global declaration
main.c:190: warning: shadowed declaration is here
main.c: In function `moyenne':
main.c:206: warning: declaration of `moyenne' shadows a global declaration
main.c:205: warning: shadowed declaration is here
main.c: At top level:
main.c:263: warning: declaration of `moyenne' shadows a global declaration
main.c:205: warning: shadowed declaration is here
main.c: In function `regression_groupe':
main.c:314: warning: passing arg 1 of `moyenne' as `float' rather than `double' due to prototype
main.c:315: warning: passing arg 1 of `moyenne' as `float' rather than `double' due to prototype
main.c:320: warning: passing arg 4 of `calcul_somme2' as `float' rather than `double' due to prototype
main.c:321: warning: passing arg 1 of `calcul_a' as `float' rather than `double' due to prototype
main.c:321: warning: passing arg 2 of `calcul_a' as `float' rather than `double' due to prototype
main.c:321: warning: passing arg 3 of `calcul_a' as `float' rather than `double' due to prototype
main.c:321: warning: passing arg 4 of `calcul_a' as `float' rather than `double' due to prototype
main.c:322: warning: passing arg 1 of `calcul_b' as `float' rather than `double' due to prototype
main.c:322: warning: passing arg 2 of `calcul_b' as `float' rather than `double' due to prototype
main.c:322: warning: passing arg 3 of `calcul_b' as `float' rather than `double' due to prototype
main.c:309: warning: unused variable `i'
main.c:301: warning: unused parameter `nb_grp'
main.c: In function `distance':
main.c:376: warning: control reaches end of non-void function
main.c: In function `index_min':
main.c:383: warning: declaration of `index' shadows a global declaration
<built-in>:0: warning: shadowed declaration is here
gcc.exe -D__DEBUG__ dexe/conio.o dexe/main.o -o "dexe\Projet1.exe" -L"C:/DEV-CPP/lib" C:/Dev-Cpp/lib/libws2_32.a C:/Dev-Cpp/lib/libSDLmain.a C:/Dev-Cpp/lib/libSDL_image.a C:/Dev-Cpp/lib/libSDL.a d:/clib/ed/devcpp/lib/ed.a -g3 Exécution terminée
|
A part ça, je conseille de tout passer en double (et donc de mettre "%lf" dans les fscanf())
D'éviter les lignes de plus 80 colonnes
Tester les retours de malloc(), supprimmer les casts inutiles. Libérer les blocs après utilisation.
http://mapage.noos.fr/emdel/notes.htm#malloc
Ne pas utiliser feof() mais la valeur retournée par la fonction de lecture.
http://mapage.noos.fr/emdel/notes.htm#fichiers
Sur le plan de la conception, un refactoring basé sur deux tableaux de structures serait préférable à ces tableaux individuels...
J'ai obtenu un fichier HTML qui n'a pas fait planté mon Firefox. C'est bien.
http://mapage.noos.fr/emdel/results/out.txt.html
Message édité par Emmanuel Delahaye le 12-03-2005 à 10:43:02
---------------
Des infos sur la programmation et le langage C: http://www.bien-programmer.fr Pas de Wi-Fi à la maison : http://www.cpl-france.org/