Pages : 1
#1 Le 14/04/2008, à 08:17
- mary4
gestion en c
bonjour,
J'ai commencé à programmer en c depuis peu et je m'entraîne avec un programme sur la gestion de produit, j'ai corrigé plusieurs erreurs et quand j'exécute toute s'affiche en boucle, quelqu'un pourrait m'aider à corriger ou à me dire ce qu'il ne va pas??
lien corrigé:
http://dl.free.fr/iirEC2oqy/perso.c
merci
#2 Le 14/04/2008, à 09:05
- Gojita
Re : gestion en c
Bein disons qu'avant de faire le switch, faudrait que tu demandes à l'utilisateur de rentrer une valeur et que le mette dans choix.
Sinon "choix" est non initialiser (et donc valeur inconnue)
Cordialement
Il y a 10 sortes de personnes
Celles qui savent compter en binaires et les autres.
Hors ligne
#3 Le 14/04/2008, à 18:28
- nicolas.sitbon
Re : gestion en c
il y a quelques erreurs...
perso.c:87: attention : return type of «main" is not «int"
perso.c: In function «main":
perso.c:133: erreur: implicit declaration of function «getch"
perso.c:133: attention : nested extern declaration of «getch"
perso.c: In function «AjoutProd":
perso.c:294: attention : format «%d" expects type «int *", but argument 2 has type «long int *"
perso.c:324: attention : comparaison entre un pointeur et un entier
perso.c:337: attention : passing argument 1 of «strcpy" makes pointer from integer without a cast
perso.c:339: attention : passing argument 1 of «strcpy" makes pointer from integer without a cast
perso.c:341: attention : passing argument 1 of «strcpy" makes pointer from integer without a cast
perso.c:374: attention : format «%f" expects type «float *", but argument 2 has type «double"
perso.c:381: attention : format «%c" expects type «char *", but argument 2 has type «int *"
perso.c:388: attention : passing argument 1 of «TriSt" from incompatible pointer type
perso.c:271: attention : unused variable «a"
perso.c:271: attention : unused variable «x"
perso.c: In function «SupprimProd":
perso.c:516: attention : format «%d" expects type «int *", but argument 2 has type «short int *"
perso.c: In function «AfficheUn":
perso.c:602: attention : format «%d" expects type «int", but argument 2 has type «long int"
perso.c:605: attention : format «%s" expects type «char *", but argument 2 has type «int"
perso.c: In function «TriProd":
perso.c:644: attention : parenthèses suggérées autour de l'affectation utilisée comme valeur de vérité
perso.c: In function «AjoutDep":
perso.c:804: attention : format «%d" expects type «int *", but argument 2 has type «long int *"
perso.c:810: attention : format «%s" expects type «char *", but argument 2 has type «char (*)[20]"
perso.c:832: attention : format «%d" expects type «int *", but argument 2 has type «long int *"
perso.c:857: attention : format «%d" expects type «int *", but argument 2 has type «short int *"
perso.c:785: attention : unused variable «j"
perso.c:785: attention : unused variable «x"
perso.c: In function «AfficheUnDep":
perso.c:939: attention : format «%d" expects type «int", but argument 2 has type «long int"
perso.c:941: attention : format «%c" expects type «int", but argument 2 has type «char *"
perso.c:944: attention : format «%f" expects type «double", but argument 2 has type «long int"
perso.c:946: attention : format «%s" expects type «char *", but argument 2 has type «int"
perso.c: In function «RechercheDep":
perso.c:1040: attention : format «%d" expects type «int *", but argument 2 has type «short int *"
perso.c: In function «AjoutSt":
perso.c:1262: attention : format «%d" expects type «int *", but argument 2 has type «long int *"
perso.c:1265: attention : format «%d" expects type «int *", but argument 2 has type «long int *"
perso.c:1278: attention : format «%d" expects type «int *", but argument 2 has type «long int *"
perso.c: In function «AfficheUnSt":
perso.c:1380: attention : format «%d" expects type «int", but argument 2 has type «long int"
perso.c:1381: attention : format «%d" expects type «int", but argument 2 has type «long int"
perso.c:1382: attention : format «%d" expects type «int", but argument 2 has type «long int"
Dernière modification par nicolas.sitbon (Le 14/04/2008, à 18:28)
Hors ligne
#4 Le 14/04/2008, à 18:41
- rniamo
Re : gestion en c
surtout des erreurs de castage...ça sens le copier-coller
< Quelques un des mes programmes | Cuisine Facile (pour les gourmands) | Fast MVC for PHP >
\ ^__^
\ (o o)\_______
(___)\ )\
Hors ligne
#5 Le 18/04/2008, à 17:11
- mary4
Re : gestion en c
bonjour,
voici mon code un peu amélioré...
mon problème se trouve surtout au modification de produit ou dépôt, car quand il n'y a aucun produit ou dépôt, ça fonctionne mais dés qu'il en trouve un il ne veut pas le modifier.
http://dl.free.fr/oiNWy7t2H/perso_c2.c
merci
#6 Le 18/04/2008, à 20:18
- rniamo
Re : gestion en c
quel est le problème exacte et à quel niveau ? Donne un peu ta modélisation. (désolé, j'arrive pas à récupèré ton code avec la connexion que j'ai actuellemnt, tout est un peu bloqué)
Dernière modification par rniamo (Le 18/04/2008, à 20:18)
< Quelques un des mes programmes | Cuisine Facile (pour les gourmands) | Fast MVC for PHP >
\ ^__^
\ (o o)\_______
(___)\ )\
Hors ligne
#7 Le 18/04/2008, à 21:30
- nicolas.sitbon
Re : gestion en c
main.c:98: attention : function declaration isn"t a prototype
main.c: In function «main":
main.c:147: erreur: implicit declaration of function «getch"
main.c:147: attention : nested extern declaration of «getch"
main.c: In function «AjoutProd":
main.c:263: attention : format «%d" expects type «int *", but argument 2 has type «long int *"
main.c:298:29: attention : constante caractère multi-caractères
main.c:298: attention : débordement dans la conversion implicte de la constante
main.c:301:29: attention : constante caractère multi-caractères
main.c:301: attention : débordement dans la conversion implicte de la constante
main.c:316: attention : format «%f" expects type «float *", but argument 2 has type «double"
main.c:332:28: attention : constante caractère multi-caractères
main.c:334: attention : assignment makes integer from pointer without a cast
main.c:340: attention : passing argument 1 of «TriSt" from incompatible pointer type
main.c:239: attention : unused variable «a"
main.c: In function «SupprimProd":
main.c:429: attention : format «%d" expects type «int *", but argument 2 has type «short int *"
main.c:493:29: attention : constante caractère multi-caractères
main.c: In function «ModifProd":
main.c:493: attention : débordement dans la conversion implicte de la constante
main.c:495:29: attention : constante caractère multi-caractères
main.c:495: attention : débordement dans la conversion implicte de la constante
main.c:509: attention : format «%f" expects type «float *", but argument 2 has type «double"
main.c:527:28: attention : constante caractère multi-caractères
main.c:529:28: attention : constante caractère multi-caractères
main.c: In function «AfficheUn":
main.c:547: attention : format «%d" expects type «int", but argument 2 has type «long int"
main.c:550: attention : format «%s" expects type «char *", but argument 2 has type «int"
main.c: In function «TriProd":
main.c:575: attention : parenthèses suggérées autour de l'affectation utilisée comme valeur de vérité
main.c: In function «AjoutDep":
main.c:670: attention : format «%d" expects type «int *", but argument 2 has type «long int *"
main.c:676: attention : format «%s" expects type «char *", but argument 2 has type «char (*)[20]"
main.c:698: attention : format «%d" expects type «int *", but argument 2 has type «long int *"
main.c:723: attention : format «%d" expects type «int *", but argument 2 has type «short int *"
main.c:651: attention : unused variable «j"
main.c: In function «AfficheUnDep":
main.c:776: attention : format «%d" expects type «int", but argument 2 has type «long int"
main.c:778: attention : format «%c" expects type «int", but argument 2 has type «char *"
main.c:781: attention : format «%f" expects type «double", but argument 2 has type «long int"
main.c:783: attention : format «%s" expects type «char *", but argument 2 has type «int"
main.c: In function «RechercheDep":
main.c:843: attention : format «%d" expects type «int *", but argument 2 has type «short int *"
main.c: In function «AjoutSt":
main.c:993: attention : format «%d" expects type «int *", but argument 2 has type «long int *"
main.c:996: attention : format «%d" expects type «int *", but argument 2 has type «long int *"
main.c:1009: attention : format «%d" expects type «int *", but argument 2 has type «long int *"
main.c: In function «AfficheUnSt":
main.c:1086: attention : format «%d" expects type «int", but argument 2 has type «long int"
main.c:1087: attention : format «%d" expects type «int", but argument 2 has type «long int"
main.c:1088: attention : format «%d" expects type «int", but argument 2 has type «long int"
main.c: In function «SupprimDep":
main.c:1196: attention : format «%d" expects type «int *", but argument 2 has type «short int *"
main.c: In function «RechercheProdNum":
main.c:1227: attention : format «%d" expects type «int *", but argument 2 has type «short int *"
*** Error code 1
toujours pareil : corrige tes erreurs et poste un code qui compile...
Hors ligne
#8 Le 18/04/2008, à 22:35
- mary4
Re : gestion en c
bonjour,
Je trouve ça bizarre car chez moi il compile et j'arrive à exécuter et je n'ai pas les warning/errors come vous.
merci
#9 Le 18/04/2008, à 22:51
- nicolas.sitbon
Re : gestion en c
C'est que tu règles très mal ton compilateur et ce n'est en aucun cas un problème de cast comme j'ai pu le lire.
Hors ligne
#10 Le 19/04/2008, à 17:26
- rniamo
Re : gestion en c
à aprt l'erreur getch les autres sont pas trés graves à mon sens.
PS : pour le réglage du compilo : -pedantic -ansi -Wall
< Quelques un des mes programmes | Cuisine Facile (pour les gourmands) | Fast MVC for PHP >
\ ^__^
\ (o o)\_______
(___)\ )\
Hors ligne
#11 Le 19/04/2008, à 20:10
- nicolas.sitbon
Re : gestion en c
La plupart invoquent des comportements indéterminés et d'autres sont carrément des abérrations.
Hors ligne
Pages : 1