Bonjour,
j ai fait un programme en c++ de gestion de location de voiture il me reste une partie la restitution de voiture voici mon programme aider moi svplé c urgnt
merci de votre attention
#include<stdio.h>
#include<conio.h>
#include<string.h>
typedef struct
{
char marque[30];
char matricule[20];
int kilo;
int dispo;
float prixkilo;
}voiture;
typedef struct
{
char nomclient[30];
char cin[20];
char tel[20];
char matricule[20];
float avance;
}location;
voiture t[50];
int i=0;
location s[50];
int l=0;
void cadre(int x1, int y1, int x2, int y2)
{ int j;
gotoxy(x1,y1);printf("Ú");gotoxy(x2,y1);printf("¿");
gotoxy(x1,y2);printf("À");gotoxy(x2,y2);printf("Ù");
for(j=x1+1;j<x2;j++)
{ gotoxy(j,y1);printf("Ä"); gotoxy(j,y2);printf("Ä");}
for(j=y1+1;j<y2;j++)
{ gotoxy(x1,j);printf("³"); gotoxy(x2,j);printf("³");}
}
char menu(void)
{
char val;
cadre(20,13,61,30);
cadre(20,33,61,37);
gotoxy(24,17);printf("1 : GESTION DES VOITURES");
gotoxy(24,22);printf("2 : GESTION DES LOCATIONS");
gotoxy(24,27);printf("ESC : QUITTER");
gotoxy(24,35);printf("VOTRE CHOIX:");
gotoxy(37,35); val=getch();
return val;
}
char menul(void)
{
char val1;
_setcursortype(_NORMALCURSOR);
cadre(20,13,61,25);
cadre(20,33,61,37);
gotoxy(24,17);printf("1 : LOCATION D'UNE VOITURE");
gotoxy(24,21);printf("2 : RESTITUTION D'UNE VOITURE");
gotoxy(24,35);printf("VOTRE CHOIX:");
gotoxy(37,35); val1=getch();
return val1;
}
void masque(void)
{
clrscr();
cadre(20,13,61,32);
gotoxy(24,14);printf("MARQUE :");
gotoxy(24,18);printf("MATRICULE :");
gotoxy(24,22);printf("KILOMETRAGE :");
gotoxy(24,26);printf("DISPONIBILITE :");
gotoxy(24,30);printf("PRIX DU KILOMETRE :");
gotoxy(3,50);printf("F1: Nouveau");
gotoxy(18,50);printf("F2: Consulter");
gotoxy(35,50);printf("F3: Modifier");
gotoxy(52,50);printf("F4: Supprimer");
gotoxy(70,50);printf("ESC: MENU");
}
void masquel(void)
{
clrscr();
cadre(20,13,61,36);
gotoxy(24,16);printf("NOM DU CLIENT :");
gotoxy(24,20);printf("CIN :");
gotoxy(24,24);printf("TELEPHONE :");
gotoxy(24,28);printf("MATRICULE DE LA VOITURE :");
gotoxy(24,32);printf("L'AVANCE :");
gotoxy(3,50);printf("F1: Nouveau");
gotoxy(18,50);printf("F2: Consulter");
gotoxy(35,50);printf("F3: Modifier");
gotoxy(52,50);printf("F4: Supprimer");
gotoxy(70,50);printf("ESC: MENU");
}
void masquer(void)
{
clrscr();
cadre(20,1,61,10);
cadre(20,12,61,42);
gotoxy(24,4);printf("CIN :");
gotoxy(24,7);printf("MATRICULE DE LA VOITURE :");
gotoxy(24,15);printf("NOM DU CLIENT :");
gotoxy(24,18);printf("TELEPHONE :");
gotoxy(24,21);printf("MARQUE DE LA VOITURE :");
gotoxy(24,24);printf("DISPONIBILITE :");
gotoxy(24,27);printf("PRIX DU KILOMETRE :");
gotoxy(24,30);printf("ANCIEN KILOMETRAGE :");
gotoxy(24,33);printf("NOUVEAU KILOMETRAGE :");
gotoxy(24,36);printf("L'AVANCE :");
gotoxy(24,39);printf("PRIX A PAYER :");
gotoxy(3,50);printf("F1: Nouveau");
gotoxy(18,50);printf("F2: Consulter");
gotoxy(35,50);printf("F3: Modifier");
gotoxy(52,50);printf("F4: Supprimer");
gotoxy(70,50);printf("ESC: MENU");
}
voiture lecture(void)
{
voiture s;
float x;
_setcursortype(_NORMALCURSOR);
gotoxy(33,14); fflush(stdin);gets(s.marque);
gotoxy(36,18); fflush(stdin);gets(s.matricule);
gotoxy(38,22); scanf("%d",&s.kilo);
gotoxy(40,26); scanf("%d",&s.dispo);
gotoxy(44,30); scanf("%f",&x);
s.prixkilo=x;
return s;
}
location locationv(void)
{
location m;
float y;
_setcursortype(_NORMALCURSOR);
gotoxy(40,16); fflush(stdin);gets(m.nomclient);
gotoxy(30,20); fflush(stdin);gets(m.cin);
gotoxy(36,24); fflush(stdin);gets(m.tel);
gotoxy(50,28); fflush(stdin);gets(m.matricule);
gotoxy(35,32); scanf("%f",&y);
m.avance=y;
return m;
}
void consultationl(void)
{
int k;
for(k=0;k<l;k++)
{
masquel();
gotoxy(40,16); printf("%s",s[k].nomclient);
gotoxy(30,20); printf("%s",s[k].cin);
gotoxy(36,24); printf("%s",s[k].tel);
gotoxy(50,28); printf("%s",s[k].matricule);
gotoxy(35,32); printf("%.2f",s[k].avance);
getch();
}
}
void consultation(void)
{
int j;
for(j=0;j<i;j++)
{
masque();
gotoxy(33,14); printf("%s",t[j].marque);
gotoxy(36,18); printf("%s",t[j].matricule);
gotoxy(38,22); printf("%d",t[j].kilo);
gotoxy(40,26); printf("%d",t[j].dispo);
gotoxy(44,30); printf("%.2f",t[j].prixkilo);
getch();
}
}
void consultationp(void)
{
int j;
char mat[20];
gotoxy(10,5); printf("Donner le matricule … chercher: ");
fflush(stdin); gets(mat);
for(j=0;j<i;j++)
{
if(stricmp(t[j].matricule,mat)==0)
{
masque();
gotoxy(33,14); printf("%s",t[j].marque);
gotoxy(36,18); printf("%s",t[j].matricule);
gotoxy(38,22); printf("%d",t[j].kilo);
gotoxy(40,26); printf("%d",t[j].dispo);
gotoxy(44,30); printf("%.2f",t[j].prixkilo);
getch();
}
}
}
void consultationpl(void)
{
int k;
char mat3[20];
gotoxy(10,5); printf("Donner le matricule … chercher: ");
fflush(stdin); gets(mat3);
for(k=0;k<l;k++)
{
if(stricmp(s[k].matricule,mat3)==0)
{
masquel();
gotoxy(40,16); printf("%s",s[k].nomclient);
gotoxy(30,20); printf("%s",s[k].cin);
gotoxy(36,24); printf("%s",s[k].tel);
gotoxy(50,28); printf("%s",s[k].matricule);
gotoxy(35,32); printf("%.2f",s[k].avance);
getch();
}
}
}
void supression(void)
{
int j,k;
char mat[20];
gotoxy(10,5); printf("Donner le matricule de la voiture … supprimer : ");
fflush(stdin); gets(mat);
for(j=0;j<i;j++)
if(stricmp(t[j].matricule,mat)==0)
{
for(k=j;k<i;k++)
t[k]=t[k+1];
i--;
gotoxy(10,7);printf("...Donn‚es Supprim‚es !"); getch();
}
}
void supressionl(void)
{
int k,j;
char mat2[20];
gotoxy(10,5); printf("Donner le matricule de la voiture … supprimer : ");
fflush(stdin); gets(mat2);
for(k=0;k<l;k++)
if(stricmp(s[k].matricule,mat2)==0)
{
for(j=k;j<l;j++)
s[j]=s[j+1];
l--;
gotoxy(10,7);printf("...Donn‚es Supprim‚es !"); getch();
}
}
void modification(void)
{
int j;
char mat[20];
gotoxy(10,5); printf("Donner la matricule de la voiture … modifier : ");
fflush(stdin); gets(mat);
for(j=0;j<i;j++)
if(stricmp(t[j].matricule,mat)==0)
{
clrscr();
masque();
t[j]=lecture();
}
}
void modificationl(void)
{
int k;
char mat1[20];
gotoxy(10,5); printf("Donner la matricule de la voiture … modifier : ");
fflush(stdin); gets(mat1);
for(k=0;k<l;k++)
if(stricmp(s[k].matricule,mat1)==0)
{
clrscr();
masquel();
s[k]=locationv();
}
}
void gestionvoiture(void)
{
char ch,rep;
voiture tmp;
do{
_setcursortype(_NOCURSOR);
masque();
ch=getch(); if(ch==0) ch=getch();
switch(ch)
{
case 59:
tmp=lecture();
gotoxy(20,33); printf("Confirmez vous ces informations ? (O/N) :");
rep=getch();
if(rep=='o'){t[i]=tmp; i++;
gotoxy(24,35); printf("...OK"); getch(); }
break;
case 60:consultation(); break;
case 61:modification(); break;
case 62:supression(); break;
case 63:consultationp();break;
//getch();
}
}while(ch!=27);
}
void gestionlocation(void)
{
int t,j;
char choix1,ch1,ch2,rep1;
char ma[30],cin1[30];
float som;
do{
clrscr();
choix1=menul();
location tmp1;
switch(choix1)
{
case '1': //location voiture
do{
_setcursortype(_NOCURSOR);
masquel();
ch1=getch(); if(ch1==0) ch1=getch();
switch(ch1)
{
case 59:
tmp1=locationv();
gotoxy(20,38); printf("Confirmez vous ces informations ? (O/N) :");
rep1=getch();
if(rep1=='o'){s[l]=tmp1; l++;
gotoxy(24,40); printf("...OK"); getch(); }
break;
case 60: consultationl(); break;
case 61: modificationl(); break;
case 62: supressionl(); break;
case 63: consultationpl();break;
}
}while(ch1!=27);
break;
case '2': //restitution d'une voiture
_setcursortype(_NOCURSOR);
do{
masquer();
ch2=getch(); if(ch2==0) ch2=getch();
switch(ch2)
{
case 59:clrscr(); masquer();
break;
case 60: break;
case 61:break;
case 62: break;
case 63: break;
}
}while(ch2!=27);
break;
}
}while(choix1!=27);
}
void main()
{
clrscr();
char choix;
textmode(64);
do
{
_setcursortype(_NORMALCURSOR);
clrscr();
choix=menu();
switch(choix)
{
case '1': gestionvoiture();
break;
case '2':clrscr(); gestionlocation();
break;
}
}while(choix!=27);
}
Configuration: Windows XP
Firefox 3.0