commit
420d02c8b3
@ -0,0 +1,24 @@
|
|||||||
|
//
|
||||||
|
// Created by Mathéo Hersan on 16/10/2023.
|
||||||
|
//
|
||||||
|
|
||||||
|
#include "client.h"
|
||||||
|
|
||||||
|
void afficherDonneesClient() {
|
||||||
|
FILE *fichier = fopen("donnee/client.txt", "r");
|
||||||
|
int numeroClient;
|
||||||
|
float cagnotte;
|
||||||
|
int suspendu;
|
||||||
|
|
||||||
|
if (fichier == NULL) {
|
||||||
|
fprintf(stderr, "Erreur lors de l'ouverture du fichier");
|
||||||
|
exit(EXIT_FAILURE);
|
||||||
|
}
|
||||||
|
|
||||||
|
while (fscanf(fichier, "%d%f%d", &numeroClient, &cagnotte, &suspendu) == 3) {
|
||||||
|
printf("Client %d, Cagnotte %.2f, Suspendu: %s\n",
|
||||||
|
numeroClient, cagnotte, (suspendu == 0) ? "Non" : "Oui");
|
||||||
|
}
|
||||||
|
|
||||||
|
fclose(fichier);
|
||||||
|
}
|
@ -0,0 +1,13 @@
|
|||||||
|
//
|
||||||
|
// Created by Mathéo Hersan on 16/10/2023.
|
||||||
|
//
|
||||||
|
|
||||||
|
#ifndef SAE_101_CLIENT_H
|
||||||
|
#define SAE_101_CLIENT_H
|
||||||
|
|
||||||
|
#include<stdio.h>
|
||||||
|
#include<stdlib.h>
|
||||||
|
|
||||||
|
void afficherDonneesClient();
|
||||||
|
|
||||||
|
#endif //SAE_101_CLIENT_H
|
@ -0,0 +1,48 @@
|
|||||||
|
#include "interface_client.h"
|
||||||
|
#include "app/core_logic/client.h"
|
||||||
|
|
||||||
|
void affiche_client(int a){
|
||||||
|
printf("\n");
|
||||||
|
printf("+-------------+ \n");
|
||||||
|
printf("|| Bonjour ! ||\n") ;
|
||||||
|
printf("+-------------+ \n");
|
||||||
|
printf("\n");
|
||||||
|
printf("+-----------------------------------------------------------------+\n");
|
||||||
|
printf("|| Que voulez-vous faire ? \t \t \t \t \t || \n");
|
||||||
|
printf("||\t1 : Afficher le récapitulatif du panier. \t \t || \n");
|
||||||
|
printf("||\t2 : Ajouter un article du panier. \t \t \t || \n");
|
||||||
|
printf("||\t3 : Supprimer un article du panier. \t \t \t || \n");
|
||||||
|
printf("||\t4 : Modifier la quantité d'un article du panier. \t || \n");
|
||||||
|
printf("||\t5 : Réinitialiser le panier. \t \t \t \t || \n");
|
||||||
|
printf("+-----------------------------------------------------------------+\n");
|
||||||
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Sert à lancer le menu et faire choisir l'utilisateur
|
||||||
|
*/
|
||||||
|
void menu(int *choix, int jour) {
|
||||||
|
affiche_client(jour);
|
||||||
|
printf("Vous choisissez: ");
|
||||||
|
scanf("%d", choix);
|
||||||
|
|
||||||
|
while (*choix < 0)
|
||||||
|
{
|
||||||
|
affiche_client(jour);
|
||||||
|
printf("Vous choisissez: ");
|
||||||
|
printf("Veuillez entrer un choix valide ! \n");
|
||||||
|
scanf("%d", choix);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void global_client(){
|
||||||
|
int choix, jour;
|
||||||
|
menu(&choix, jour);
|
||||||
|
switch (choix) {
|
||||||
|
case 1:
|
||||||
|
afficherDonneesClient();
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
printf("Veuillez entrer un choix valide ! \n");
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,5 @@
|
|||||||
|
#include<stdio.h>
|
||||||
|
|
||||||
|
void affiche_client(int a);
|
||||||
|
void menu(int *choix, int a);
|
||||||
|
void global_client();
|
@ -0,0 +1 @@
|
|||||||
|
#include "interface_resp.h"
|
@ -1,6 +1,30 @@
|
|||||||
#include<stdio.h>
|
#include<stdio.h>
|
||||||
#include<stdlib.h>
|
#include<stdlib.h>
|
||||||
|
#include "app/interface/interface_client.h"
|
||||||
|
#include "app/interface/interface_resp.h"
|
||||||
|
#include "app/core_logic/client.h"
|
||||||
|
|
||||||
|
int choixInterface(void) {
|
||||||
|
int choix;
|
||||||
|
printf("Choix de l'interface: \n");
|
||||||
|
printf("1. Interface 'responsable': Pour les responsables \n");
|
||||||
|
printf("2. Interface 'Client' : Pour les clients\n");
|
||||||
|
printf("Vous choisissez l'interface n°: ");
|
||||||
|
scanf("%d", &choix);
|
||||||
|
if (choix < 0 || choix > 1) {
|
||||||
|
fprintf(stderr,"Veuillez entrer un choix valide ! \n");
|
||||||
|
}
|
||||||
|
switch (choix) {
|
||||||
|
case 1: printf("Vous avez choisit l'interface responsable.\n"); break;
|
||||||
|
case 2: printf("Vous avez choisit l'interface client.\n");
|
||||||
|
}
|
||||||
|
return choix;
|
||||||
|
}
|
||||||
|
|
||||||
int main(){
|
int main(){
|
||||||
printf("Hello World\n");
|
switch (choixInterface()) {
|
||||||
|
//case 1: global_resp();
|
||||||
|
case 2: global_client();
|
||||||
|
}
|
||||||
|
return 0;
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in new issue