Bonsoir je suis un etudiant d'une ecole d'informatique ... et j'ai quelque difficulté à programme. j'ai cherché les erreurs mais je ne les trouvent pas. s'il vous plait Help me if you can ! :)
************************************************************************
#include<stdio.h>
#include<conio.h>
struct rayon {
int ref,flag,ni,nc,e,s;
char des[10];
}ry;
FILE *fry;
int nm;
int i,flagr=0;
//****************************void grille();
void grille(){ int k;
for(k=11;k<=69;k++){
gotoxy(k,7);printf("%c",196);
gotoxy(k,16);printf("%c",196);
}
for(k=8;k<=16;k++){
gotoxy(10,k);printf("%c",179);
gotoxy(70,k);printf("%c",179);
}
gotoxy(10,7);printf("%c",218);
gotoxy(10,16);printf("%c",196);
gotoxy(70,7);printf("%c",191);
gotoxy(70,6);printf("%c",217);
gotoxy(40,8);puts("reference:");
gotoxy(30,9);puts("designation");
gotoxy(30,10);puts("niveau minimal");
gotoxy(30,11);puts("niveau initial");
gotoxy(30,12);puts("niveau cours");
gotoxy(30,13);puts("entree");
gotoxy(30,14);puts("sortie");
}
//******************void affiche
void affiche(){
gotoxy(55,8);printf("%d",ry.ref);
gotoxy(55,9);printf("%s",ry.des);
gotoxy(55,10);printf("%d",nm);
gotoxy(55,11);printf("%d",ry.ni);
gotoxy(55,12);printf("%d",ry.nc);
gotoxy(55,13);printf("%d",ry.e);
gotoxy(55,14);printf("%d",ry.s);
}
//***********************void calcul
void calcul(){
ry.nc=ry.ni+ry.e-ry.s;
if(ry.nc>=nm){puts("stock bien approvisionné");}
else{puts("attention ! approvisionner le stock");}
}
//*******************************stockage
void stockage(){
char rep;
if(fry!=NULL){puts("déjà existant");}
else{
fry=fopen("rayon.dat","w");
do{ clrscr();
grille();
gotoxy(55,8);scanf("%d",&ry.ref);
gotoxy(55,9);scanf("%s",&ry.des);
gotoxy(55,10);scanf("%d",&nm);
gotoxy(55,11);scanf("%d",&ry.ni);
gotoxy(55,13);scanf("%d",&ry.e);
gotoxy(55,14);scanf("%d",&ry.s);
ry.flag=1;
calcul();
gotoxy(55,12);printf("%d",&ry.nc);
fwrite(&ry,sizeof(ry),1,fry);
puts("autre entrée o/n");
rep=getch();
}while(rep=='o'||'O');
fclose(fry);
}
}
//***************************************affichage
void affichage(){
fry=fopen("rayon.dat","r");
do{
fread(&ry,sizeof(ry),1,fry);
if(ry.flag==1){
grille();
affiche();
getch();
clrscr();}
}while(!feof(fry));
fclose(fry);
}
//***************************recherche
void rech(){
int x;i=0;
fry=fopen("rayon.dat","R+");
rewind(fry);
puts("renter la type de carte à rechercher");
scanf("%d",&x);
while( (fread(&ry,sizeof(ry),1,fry)!=0) && (flagr==0)) {
if(ry.ref==x){flagr=1;}
else{flagr=0;}
}}
void rechercher(){
rech();
if(flagr==0){clrscr();
puts("inexistant");}
else{clrscr();
grille();
affiche();
}getch();
}
//**************************void modification
void modification(){
int rep;
char rep1,rep2;
fry=fopen("rayon.dat","R+");
do{clrscr();
rech();
if(flagr==0){
puts("inexistant");
}
else{ //g=ftell(fry);
grille();
affiche();
getch();
do{ clrscr();
puts("Menu modif");
puts("1...........reference");
puts("2...........designation");
puts("3...........niveau initial");
puts("4...........entree");
puts("5...........sortie");
puts("6...........quitter");
puts("votre choix");
scanf("%d",&rep);
switch(rep){
case 1:puts("rentrer la nouvelle reference");
scanf("%d",&ry.ref);break;
case 2:puts("rentrer la nouvelle des");
scanf("%d",&ry.des);break;
case 3:puts("rentrer le nouveau niveau initial");
scanf("%d",&ry.ni);break;
case 4:puts("ajout d'article");
scanf("%d",&ry.e);break;
case 5:puts("supprimer des articles");
scanf("%d",&ry.s);break;
case 6:break;
default:puts("tapez 1,2,3,4,5, ou 6");
}
fwrite(&ry,-1*sizeof(ry),1,fry);
puts("autre modification o/n");
rep1=getch();
}while(rep1=='o');
}
puts("autre rayon o/n");
rep2=getch();
}while(rep2=='o');
fclose(fry);
}
//**************************************void suppression
void suppression(){
rech();
if(flagr==0){clrscr();
puts("inexistant");}
else{ry.flag=0;
puts("it has been deleted");
getch();
}
}
//***************************************void main
void main(){int h;
int rep3;
do{clrscr();
for(h=20;h<=69;h++){
gotoxy(h,13);printf("%c",196);
gotoxy(h,23);printf("%c",196);
}
for(h=13;h<=23;h++){
gotoxy(20,h);printf("%c",179);
gotoxy(70,h);printf("%c",179);
}
gotoxy(20,13);printf("%c",218);
gotoxy(20,23);printf("%c",196);
gotoxy(70,13);printf("%c",191);
gotoxy(70,23);printf("%c",217);
gotoxy(40,15);puts("menu");
gotoxy(30,16);puts("1...........stockage");
gotoxy(30,17);puts("2...........affichage");
gotoxy(30,18);puts("3...........recherche");
gotoxy(30,19);puts("4...........modification");
gotoxy(30,20);puts("5...........suppression");
gotoxy(30,21);puts("6...........quitter");
gotoxy(40,22);puts("votre choix");
gotoxy(55,22);scanf("%d",&rep3);
switch(rep3){
case 1:stockage();break;
case 2:affichage();break;
case 3:rechercher();break;
case 4:modification();break;
case 5:suppression();break;
case 6:break;
default: puts("entrer un chiffre entre 1 et 6");
}
}while(rep3!=6);
}
*********************************************************
Afficher la suite