slut tout le monde,je suis etudiant en train de developer mon projet (distributeur automatiques de billets) j'ai presque finie de le terminer mais il me reste encore des erreurs qui m'ont gen้ beaucoups,j'ai trouv้ de solutions,en effet je demande votre aides monsieurs,voila la code source :
et voila mon email :walid2007@hotmail.com
#include<conio.h>
#include<stdio.h>
#include<string.h>
#include<dos.h>
#include<time.h>pour l'apel de la fonction strcmpi
#include<ctype.h>//pour l'apel de la fonction toupper
#define per "c:\\projet.txt"
//declaratin des champs qui a utiliser
typedef struct
{
char nom[15];
char prenom[15];
long code;
long compte;
int solde;
}carte;
void ajouter()
{
int indice;
FILE *f;
carte *fiche;
clrscr();
gotoxy(30,4);cprintf("Ajout d\'une fiche");
gotoxy(22,11);cprintf("ฺฤฤฤฤฤฤฤฤฤฤฤฤฤฤฤฤฤฤฤฤฤฤฤฤฤฤฤฟ");
gotoxy(22,12);cprintf("ณ Nom : ณ");
gotoxy(22,13);cprintf(" ฤฤฤฤฤฤฤฤฤฤฤฤฤฤฤฤฤฤฤฤฤฤฤฤฤฤฤ ");
gotoxy(33,12);gets(fiche->nom);fiche->nom[0]=toupper(fiche->nom[0]);
gotoxy(22,14);cprintf("ณ Prenom : ณ");
gotoxy(22,15);cprintf(" ฤฤฤฤฤฤฤฤฤฤฤฤฤฤฤฤฤฤฤฤฤฤฤฤฤฤฤ ");
gotoxy(33,14);gets(fiche->prenom);fiche->prenom[0]=toupper(fiche->prenom[0]);
gotoxy(22,16);cprintf("ณcode : ณ");
do{textcolor(10);gotoxy(3,47);cprintf("Dans le case de la code donner 4 chiffres");
gotoxy(33,18);clreol();scanf("%ld",&fiche->code);
}while((fiche->compte>9999)||(fiche->compte<0000));
gotoxy(22,17);cprintf(" ฤฤฤฤฤฤฤฤฤฤฤฤฤฤฤฤฤฤฤฤฤฤฤฤฤฤฤ ");
gotoxy(22,18);cprintf("ณ compte : ณ");
gotoxy(22,19);cprintf("ภฤฤฤฤฤฤฤฤฤฤฤฤฤฤฤฤฤฤฤฤฤฤฤฤฤฤฤู");
do{textcolor(10);gotoxy(2,47);cprintf("Dans le case de la code donner 8 chiffres");
gotoxy(33,18);clreol();scanf("%ld",&fiche->compte);
}while((fiche->compte>99999999)||(fiche->compte<0000000));
gotoxy(22,20);cprintf(" ฤฤฤฤฤฤฤฤฤฤฤฤฤฤฤฤฤฤฤฤฤฤฤฤฤฤฤ ");
gotoxy(22,21);cprintf("ณ SOLDE : ณ");
gotoxy(22,22);cprintf("ภฤฤฤฤฤฤฤฤฤฤฤฤฤฤฤฤฤฤฤฤฤฤฤฤฤฤฤู");
scanf("%d",&fiche->solde);
if(!(f=fopen(per,"rb+")))
{
f=fopen(per,"wb");
fiche->code=1;
fwrite(fiche,sizeof(carte),1,f);
textcolor(1); gotoxy(20,24);cprintf("ษออออออออออออออออออออออออออออออออป");
textcolor(10); gotoxy(20,25);cprintf("บ Ajoute Avec Succes บ");
textcolor(1); gotoxy(20,26);cprintf("ศออออออออออออออออออออออออออออออออ?");
delay(3000);
}
else
{ indice=max(fiche->code);
if(indice==-1)
{textcolor(LIGHTRED);gotoxy(2,47);cprintf("Remarque :");
textcolor(10);
gotoxy(12,47);cprintf("Le personne saisi deja enregistrer, ");
gotoxy(48,47);cprintf("Verifier code ");
delay(4000);
}
else
{
fiche->compte=indice+1;
fseek(f,0,2);
fwrite(fiche,sizeof(carte),1,f);
textcolor(1); gotoxy(20,24);cprintf("ษออออออออออออออออออออออออออออออออป");
textcolor(10); gotoxy(20,25);cprintf("บ Ajoute Avec Succes บ");
textcolor(1); gotoxy(20,26);cprintf("ศออออออออออออออออออออออออออออออออ?");
delay(3000);
}
}
fflush(f);fclose(f);
}
int max(long c)
{
int m=0;
FILE *f;
carte fiche;
f=fopen(per,"rb");
while (fread(&fiche,sizeof(carte),1,f))
{
if(fiche.code==c)
return(-1);
if(fiche.compte>m)
m=fiche.compte;
}
return (m);
}
int verif_ncompte()
{
FILE *f;
carte fiche;
char trouve;
long compte;
int existe=0;
f=fopen(per,"rb");
gotoxy(22,11);cprintf("ฺฤฤฤฤฤฤฤฤฤฤฤฤฤฤฤฤฤฤฤฤฤฟ");
gotoxy(22,12);cprintf("ณnumero de compte : ณ");
gotoxy(22,13);cprintf("ภฤฤฤฤฤฤฤฤฤฤฤฤฤฤฤฤฤฤฤฤฤู");
do{
gotoxy(34,12);clreol();scanf("%ld",&compte);flushall();
}while((compte>99999999)||(compte<00000000));
gotoxy(22,25);printf("Compte a retouver.\n\n");delay(500);
gotoxy(22,25);printf("Compte a retouver..\n\n");delay(500);
gotoxy(22,25);printf("Compte a retouver...\n\n");delay(500);
gotoxy(22,25);printf("Compte a retouver....\n\n");delay(500);
gotoxy(22,25);printf("Compte a retouver.....\n\n");delay(500);
gotoxy(22,25);printf("Compte a retouver......\n\n");delay(500);
gotoxy(22,25);printf("Compte a retouver.......\n\n");delay(500);
while ((fread(&fiche,sizeof(carte),1,f)!=0)&&(trouve==0))
{
if(fiche.compte==compte)
existe=1;
trouve=ftell(f);
}
if(trouve==0)
{
textcolor(1); gotoxy(20,24);cprintf("ษออออออออออออออออออออออออออออออออป");
textcolor(10); gotoxy(20,25);cprintf("บ Ce compte n'existe pas บ");
textcolor(1); gotoxy(20,26);cprintf("ศออออออออออออออออออออออออออออออออ?");
textcolor(10+BLINK);gotoxy(42,47);cprintf("Tapper une touche pour revenir au menu");
textcolor(2);gotoxy(12,47);cprintf("verifiez votre numero de compte." );
getch();}
fclose(f);
return(trouve-sizeof(carte));
}
int verif_motpasse()
{
FILE *f;
carte fiche;
int existe1=0;
char trouve1;
long code;
f=fopen(per,"rb");
gotoxy(22,11);cprintf("ฺฤฤฤฤฤฤฤฤฤฤฤฤฤฤฤฤฤฤฤฤฤฟ");
gotoxy(22,12);cprintf("ณcode : ณ");
gotoxy(22,13);cprintf("ภฤฤฤฤฤฤฤฤฤฤฤฤฤฤฤฤฤฤฤฤฤู");
do{
gotoxy(34,12);clreol();scanf("%ld",&code);flushall();
}while((code>9999)||(code<0000));
gotoxy(22,25);printf("Compte a retouver.\n\n");delay(500);
gotoxy(22,25);printf("Compte a retouver..\n\n");delay(500);
gotoxy(22,25);printf("Compte a retouver...\n\n");delay(500);
gotoxy(22,25);printf("Compte a retouver....\n\n");delay(500);
gotoxy(22,25);printf("Compte a retouver.....\n\n");delay(500);
gotoxy(22,25);printf("Compte a retouver......\n\n");delay(500);
gotoxy(22,25);printf("Compte a retouver.......\n\n");delay(500);
while ((fread(&fiche,sizeof(carte),1,f)!=0)&&(trouve1==0))
{
if(fiche.code==code)
existe1=1;
trouve1=ftell(f);
}
if(trouve==0)
{
textcolor(1); gotoxy(20,24);cprintf("ษออออออออออออออออออออออออออออออออป");
textcolor(10); gotoxy(20,25);cprintf("บ Ce compte n'existe pas บ");
textcolor(1); gotoxy(20,26);cprintf("ศออออออออออออออออออออออออออออออออ?");
textcolor(10+BLINK);gotoxy(42,47);cprintf("Tapper une touche pour revenir au menu");
textcolor(2);gotoxy(12,47);cprintf("verifiez votre code." );
getch();}
fclose(f);
return(trouve1-sizeof(carte));
}
void consulter()
{
char c;
int x;
carte *fiche;
FILE *f;
f=fopen(per,"rb");
gotoxy(30,4);cprintf("Consultation de solde");
x=verif_motpasse();
if (x>=0)
{
fseek(f,x,0);
fread(fiche,sizeof(carte),1,f);
do{ gotoxy(12,47);cprintf("Tapper 1 pour retrait de solde ou S pour Sortie." );
gotoxy(22,20);printf("votre solde est:%d",fiche.solde)
gotoxy(22,24);printf(" ษอออออออออออออออออป");
gotoxy(22,25);printf(" บ Votre choix : บ");
gotoxy(22,26);printf(" ศอออออออออออออออออ?");
do{ gotoxy(45,25);
scanf("%c",&c);flushall();
while((c!='R')&&(c!='s'));
switch (c)
case 'R' : {
retrait();
break;
}
}while(c!='s');
fseek(f,x,0);
fwrite(fiche,sizeof(carte),1,f);
fclose(f);
}
void retrait()
{
char c;
int x,m;
carte *fiche;
FILE *f;
f=fopen(per,"rb+");
gotoxy(30,4);cprintf("Retrait de solde");
x=verif_motpasse();
if (x>=0)
{
fseek(f,x,0);
fread(fiche,sizeof(carte),1,f);
printf("ENTREZ LE MONTANT: ");
scanf("%d\n",&m);flushall();
if (client.solde>= m )
{ fiche.solde= fiche.solde - m;
printf("Operations effectuee Avec Succee: ");
fseek(f,x,0);
fwrite(fiche,sizeof(carte),1,f);
}
else
{
printf("Solde insuffisant Pour Effectuer cette Operations ");
}
fclose(f);
void virement()
{
int x,m;
carte *fiche;
FILE *f;
f=fopen(per,"rb+");
f=fopen(per,"rb");
gotoxy(22,11);cprintf("ฺฤฤฤฤฤฤฤฤฤฤฤฤฤฤฤฤฤฤฤฤฤฟ");
gotoxy(22,12);cprintf("ณnumero de 2 emme compte:ณ");
gotoxy(22,13);cprintf("ภฤฤฤฤฤฤฤฤฤฤฤฤฤฤฤฤฤฤฤฤฤู");
do{
gotoxy(34,12);clreol();scanf("%ld",&compte);flushall();
}while((compte>99999999)||(compte<00000000));
while ((fread(&fiche,sizeof(carte),1,f)!=0)
{
if(fiche.compte==compte)
printf("Entrer le montant เ transferer: ");
scanf("%f\n",&m);
flushall();
rewind(f);
}
{
x=verif_motpasse();
if (x>=0)
{
fseek(f,x,0);
fread(&fiche,sizeof(carte),1,f);
if (fiche.solde>= m )
fiche.solde= fiche.solde - m;
fwrite(&fiche,sizeof(fiche),1,f);
rewind(f);
else
printf("Solde insuffisant Pour Effectuer cette Operations: ");
}
}
{
fread(&fiche,sizeof(fiche),1,f);
while ((fread(&fiche,sizeof(fiche),1,f)!=0)&& ( fiche.compte!=compte ))
fiche.solde= fiche.solde + m;
fwrite(&fiche,sizeof(fiche),1,f);
printf("Operatios effectu้e Avec Succ้e !: ");
}
fclose(f);
}
void menu()
{
char choix;
do
{_setcursortype(_SOLIDCURSOR);
clrscr();
textcolor(123);
cprintf("ษออออออออออออออออออออออออออออออออออออออออออออออออออออออออออออออออออออออออออออออป");
cprintf("บDistributeur automatique de blletsบ");
cprintf("ฬออออออออออออออออออออออออออออออออออออออออออออออออออออออออออออออออออออออออออออออน");
for(int i=0;i<43;i++)
{ cprintf("บ บ");}
cprintf("ฬออออออออออออออออออออออออออออออออออออออออออออออออออออออออออออออออออออออออออออออน");
cprintf("บ บ");
cprintf("ศออออออออออออออออออออออออออออออออออออออออออออออออออออออออออออออออออออออออออออออ?");
gotoxy(20,18);printf("ษอออออออออออออออออออออออออออออออออออษอออป");
gotoxy(20,19);printf("บ COSULTATION DE SOLDE บ บ");
gotoxy(20,20);printf("ฬอออออออออออออออออออออออออออออออออออบอออน");
gotoxy(20,21);printf("บ RETRAIT DE SOLDE บ บ");
gotoxy(20,22);printf("ฬอออออออออออออออออออออออออออออออออออบอออน");
gotoxy(20,23);printf("บ VIREMENT บ บ");
gotoxy(20,24);printf("ฬอออออออออออออออออออออออออออออออออออบอออน");
gotoxy(20,25);printf("บ SORTIE บ s บ");
gotoxy(20,26);printf("ฬอออออออออออออออออออออออออออออออออออบอออน");
gotoxy(20,27);cprintf("บ บ บ");
gotoxy(20,28);printf("ศอออออออออออออออออออออออออออออออออออออออ?");
textcolor(12+BLINK);gotoxy(30,31);cprintf("VOTRE CHOIX :");
for(i=6;i<=6;i++)
{gotoxy(58,19);textcolor(i);cprintf("1");delay(100);
gotoxy(58,21);textcolor(i);cprintf("2");delay(100);
gotoxy(58,23);textcolor(i);cprintf("3");delay(100);
gotoxy(58,25);textcolor(i);cprintf("4");delay(100);
gotoxy(58,27);textcolor(i);cprintf("5");delay(100);}
textcolor(10);gotoxy(3,48);cprintf("Donner un Numero de 1 a 3 pour exucuter le fonction et Tapper pour Sortie." );
textcolor(4);gotoxy(65,48);cprintf("S");textcolor(4);
gotoxy(58,31);scanf("%c",&choix);flushall();
switch(choix)
{
case '1':{clrscr();_setcursortype(_NORMALCURSOR);consulter();break;}
case '2':{clrscr();_setcursortype(_NORMALCURSOR);retrait();break;}
case '3':{clrscr();_setcursortype(_NORMALCURSOR);virement();break;}
}
}while((choix!='s')&&(choix!='S'));
}
void main()
{
FILE *fichier;
int existe;
void ajouter();
do
{
verif_ncompte();
verifier_ncompte();
}
while (existe==1);
do
{
verif_motpasse();
}
while (existe1==1);
do
{
menu();
}