From 56dcf72d3ce29efaf527de028607dcdfde4502cb Mon Sep 17 00:00:00 2001 From: Yannis Doumir Fernandes Date: Fri, 20 Oct 2023 17:31:37 +0200 Subject: [PATCH 01/16] ADD chargementArticles() --- src/app/core_logic/responsable.c | 27 +++++++++++++++++++++++++++ src/app/core_logic/responsable.h | 3 +++ src/app/core_logic/testResponsable.c | 12 ++++++++++++ src/app/interface/interface_resp.c | 4 ++-- src/app/interface/interface_resp.h | 2 +- 5 files changed, 45 insertions(+), 3 deletions(-) create mode 100644 src/app/core_logic/testResponsable.c diff --git a/src/app/core_logic/responsable.c b/src/app/core_logic/responsable.c index e69de29..6da8f11 100644 --- a/src/app/core_logic/responsable.c +++ b/src/app/core_logic/responsable.c @@ -0,0 +1,27 @@ +#include +#include "responsable.h" + +int chargementArticles(int tRef[], float tPoids[], float tVol[], float tPrix[], float tPhysique) +{ + int i=0, ref; + float volume, poids, prix; + FILE * fe; + fe = fopen("donnee/articles.txt", "r"); + if ( fe == NULL) + { + perror("fopen"); + } + while ( fscanf(fe,"%d %f %f %f", &ref, &poids, &volume, &prix) == 4) + { + if ( i == tPhysique ) + { + fprintf(stderr,"Tableau plein"); + } + tRef[i] = ref; + tPoids[i] = poids; + tVol[i] = volume; + tPrix[i] = prix; + i++; + } + return i; +} \ No newline at end of file diff --git a/src/app/core_logic/responsable.h b/src/app/core_logic/responsable.h index e69de29..8bee266 100644 --- a/src/app/core_logic/responsable.h +++ b/src/app/core_logic/responsable.h @@ -0,0 +1,3 @@ + + +int chargementArticles(int tRef[], float tPoids[], float tVol[], float tPrix[], float tPhysique); \ No newline at end of file diff --git a/src/app/core_logic/testResponsable.c b/src/app/core_logic/testResponsable.c new file mode 100644 index 0000000..9759553 --- /dev/null +++ b/src/app/core_logic/testResponsable.c @@ -0,0 +1,12 @@ +#include +#include "responsable.h" +#include "../interface/interface_resp.h" + +int main (void) +{ + int tPhysique = 10, tRef[10], tLogique = 0; + float tPoids[10], tVol[10], tPrix[10]; + tLogique = chargementArticles( tRef, tPoids, tVol, tPrix, tPhysique); + affichArticles( tRef, tPoids, tVol, tPrix, tLogique); + return 0; +} \ No newline at end of file diff --git a/src/app/interface/interface_resp.c b/src/app/interface/interface_resp.c index be2d6ef..650d3fc 100644 --- a/src/app/interface/interface_resp.c +++ b/src/app/interface/interface_resp.c @@ -1,12 +1,12 @@ #include #include "interface_resp.h" -void affichArticles( int tRef[], float tPoids[], float tVol[], float tPrix[], int tPhysique) +void affichArticles( int tRef[], float tPoids[], float tVol[], float tPrix[], int tLogique) { int i; printf("______________________________________\n"); printf("\t Liste des articles \n\n"); - for ( i = 0; i < tPhysique; ++i) + for ( i = 0; i < tLogique; ++i) { printf("\t %d %.2f %.2f %.2f\n\n", tRef[i], tPoids[i], tVol[i], tPrix[i]); } diff --git a/src/app/interface/interface_resp.h b/src/app/interface/interface_resp.h index ef6bc7a..480a299 100644 --- a/src/app/interface/interface_resp.h +++ b/src/app/interface/interface_resp.h @@ -1,4 +1,4 @@ -void affichArticles( int tRef[], float tPoids[], float tVol[], float tPrix[], int tPhysique); +void affichArticles( int tRef[], float tPoids[], float tVol[], float tPrix[], int tLogique); void affichUnArticle(int tRef[], float tPoids[], float tVol[], float tPrix[], int tLogique, int val); void affichUnClient(int tNumClient[], float tCagnotte[], int tSus[], int tLogique, int val); void affichUnClients(int tNumClient[], float tCagnotte[], int tSus[], int tLogique, int val); \ No newline at end of file From fbcde7b85c3423b126542fcc1c35c43efb1959e8 Mon Sep 17 00:00:00 2001 From: Yannis DOUMIR FERNANDES Date: Tue, 24 Oct 2023 08:43:34 +0200 Subject: [PATCH 02/16] =?UTF-8?q?Mise=20=C3=A0=20jour=20de=20'src/app/core?= =?UTF-8?q?=5Flogic/responsable.c'?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/app/core_logic/responsable.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/app/core_logic/responsable.c b/src/app/core_logic/responsable.c index 6da8f11..8be0ff7 100644 --- a/src/app/core_logic/responsable.c +++ b/src/app/core_logic/responsable.c @@ -1,7 +1,7 @@ #include #include "responsable.h" -int chargementArticles(int tRef[], float tPoids[], float tVol[], float tPrix[], float tPhysique) +int chargementArticles(int tRef[], float tPoids[], float tVol[], float tPrix[], int tPhysique) { int i=0, ref; float volume, poids, prix; From 1c00737cfb018f271741263a20b072ecb3e43832 Mon Sep 17 00:00:00 2001 From: Yannis DOUMIR FERNANDES Date: Tue, 24 Oct 2023 08:43:50 +0200 Subject: [PATCH 03/16] =?UTF-8?q?Mise=20=C3=A0=20jour=20de=20'src/app/core?= =?UTF-8?q?=5Flogic/responsable.h'?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/app/core_logic/responsable.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/app/core_logic/responsable.h b/src/app/core_logic/responsable.h index 8bee266..485ba34 100644 --- a/src/app/core_logic/responsable.h +++ b/src/app/core_logic/responsable.h @@ -1,3 +1,3 @@ -int chargementArticles(int tRef[], float tPoids[], float tVol[], float tPrix[], float tPhysique); \ No newline at end of file +int chargementArticles(int tRef[], float tPoids[], float tVol[], float tPrix[], int tPhysique); \ No newline at end of file From 628cad5e13e0479dbed7a7042f10f9c6aa4dc202 Mon Sep 17 00:00:00 2001 From: Yannis DOUMIR FERNANDES Date: Tue, 24 Oct 2023 08:45:41 +0200 Subject: [PATCH 04/16] =?UTF-8?q?Mise=20=C3=A0=20jour=20de=20'src/app/core?= =?UTF-8?q?=5Flogic/responsable.c'?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/app/core_logic/responsable.c | 1 + 1 file changed, 1 insertion(+) diff --git a/src/app/core_logic/responsable.c b/src/app/core_logic/responsable.c index 8be0ff7..701a61c 100644 --- a/src/app/core_logic/responsable.c +++ b/src/app/core_logic/responsable.c @@ -10,6 +10,7 @@ int chargementArticles(int tRef[], float tPoids[], float tVol[], float tPrix[], if ( fe == NULL) { perror("fopen"); + return -1; } while ( fscanf(fe,"%d %f %f %f", &ref, &poids, &volume, &prix) == 4) { From a232db8ffe344615ec5fe7fb4cf2242d9848f806 Mon Sep 17 00:00:00 2001 From: Yannis DOUMIR FERNANDES Date: Tue, 24 Oct 2023 08:59:27 +0200 Subject: [PATCH 05/16] =?UTF-8?q?Mise=20=C3=A0=20jour=20de=20'src/app/core?= =?UTF-8?q?=5Flogic/responsable.c'?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/app/core_logic/responsable.c | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/src/app/core_logic/responsable.c b/src/app/core_logic/responsable.c index 701a61c..d6eeefd 100644 --- a/src/app/core_logic/responsable.c +++ b/src/app/core_logic/responsable.c @@ -25,4 +25,23 @@ int chargementArticles(int tRef[], float tPoids[], float tVol[], float tPrix[], i++; } return i; +} + +void sauvegadArticles(int tRef[], float tPoids[], float tVol[], float tPrix[], float tLogique) +{ + int i; + FILE * fe; + fe = fopen("articles.txt","w"); + if ( fe == NULL ) + { + perror("fopen"); + return -1; + } + + for ( i = 0; i < tLogique; ++i) + { + fwritef(fe,"%d\t %.2f\t %.2f\t %.2f\n", ); + } + + fclose(fe); } \ No newline at end of file From 8122a29913f623e5cbc82e5446d97ec2500587bc Mon Sep 17 00:00:00 2001 From: Yannis DOUMIR FERNANDES Date: Tue, 24 Oct 2023 08:59:49 +0200 Subject: [PATCH 06/16] =?UTF-8?q?Mise=20=C3=A0=20jour=20de=20'src/app/core?= =?UTF-8?q?=5Flogic/responsable.h'?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/app/core_logic/responsable.h | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/app/core_logic/responsable.h b/src/app/core_logic/responsable.h index 485ba34..4a9fffa 100644 --- a/src/app/core_logic/responsable.h +++ b/src/app/core_logic/responsable.h @@ -1,3 +1,4 @@ -int chargementArticles(int tRef[], float tPoids[], float tVol[], float tPrix[], int tPhysique); \ No newline at end of file +int chargementArticles(int tRef[], float tPoids[], float tVol[], float tPrix[], int tPhysique); +void sauvegadArticles(int tRef[], float tPoids[], float tVol[], float tPrix[], float tLogique); \ No newline at end of file From 0ae78125bbcd9e56a2996eb6efb082c5b133ad6f Mon Sep 17 00:00:00 2001 From: Yannis DOUMIR FERNANDES Date: Tue, 24 Oct 2023 09:07:52 +0200 Subject: [PATCH 07/16] =?UTF-8?q?Mise=20=C3=A0=20jour=20de=20'src/app/inte?= =?UTF-8?q?rface/interface=5Fclient.c'?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/app/interface/interface_client.c | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/src/app/interface/interface_client.c b/src/app/interface/interface_client.c index 193c266..2fd15ea 100644 --- a/src/app/interface/interface_client.c +++ b/src/app/interface/interface_client.c @@ -45,4 +45,16 @@ void global_client(){ printf("Veuillez entrer un choix valide ! \n"); break; } +} + +void affichAjoutArticle(int *ref, float *poids, float *volume, float *prix) +{ + printf("Entrez la ref du nouveaux produit"); + scanf("%d", ref); + printf("Entrez le poids du nouveaux produit"); + scanf("%f", poids); + printf("Entrez le volume du nouveaux produit"); + scanf("%f", volume); + printf("Entrez le prix du nouveaux produit"); + scanf("%f", prix); } \ No newline at end of file From f05a7d73d4d435b9c0dee34ae2cecc6143a9e050 Mon Sep 17 00:00:00 2001 From: Yannis DOUMIR FERNANDES Date: Tue, 24 Oct 2023 09:08:14 +0200 Subject: [PATCH 08/16] =?UTF-8?q?Mise=20=C3=A0=20jour=20de=20'src/app/inte?= =?UTF-8?q?rface/interface=5Fclient.c'?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/app/interface/interface_client.c | 11 ----------- 1 file changed, 11 deletions(-) diff --git a/src/app/interface/interface_client.c b/src/app/interface/interface_client.c index 2fd15ea..1718f20 100644 --- a/src/app/interface/interface_client.c +++ b/src/app/interface/interface_client.c @@ -47,14 +47,3 @@ void global_client(){ } } -void affichAjoutArticle(int *ref, float *poids, float *volume, float *prix) -{ - printf("Entrez la ref du nouveaux produit"); - scanf("%d", ref); - printf("Entrez le poids du nouveaux produit"); - scanf("%f", poids); - printf("Entrez le volume du nouveaux produit"); - scanf("%f", volume); - printf("Entrez le prix du nouveaux produit"); - scanf("%f", prix); -} \ No newline at end of file From c4f7096345a359338ba040be3a877d7d7a4791c2 Mon Sep 17 00:00:00 2001 From: Yannis DOUMIR FERNANDES Date: Tue, 24 Oct 2023 09:08:40 +0200 Subject: [PATCH 09/16] =?UTF-8?q?Mise=20=C3=A0=20jour=20de=20'src/app/inte?= =?UTF-8?q?rface/interface=5Fresp.c'?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/app/interface/interface_resp.c | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/src/app/interface/interface_resp.c b/src/app/interface/interface_resp.c index 650d3fc..495d6a7 100644 --- a/src/app/interface/interface_resp.c +++ b/src/app/interface/interface_resp.c @@ -51,4 +51,16 @@ void affichUnClients(int tNumClient[], float tCagnotte[], int tSus[], int tLogiq } fprintf(stderr, "Client introuvable"); printf("Client introuvable"); +} + +void affichAjoutArticle(int *ref, float *poids, float *volume, float *prix) +{ + printf("Entrez la ref du nouveaux produit"); + scanf("%d", ref); + printf("Entrez le poids du nouveaux produit"); + scanf("%f", poids); + printf("Entrez le volume du nouveaux produit"); + scanf("%f", volume); + printf("Entrez le prix du nouveaux produit"); + scanf("%f", prix); } \ No newline at end of file From 822faa411a4b0d4e312e492639e41f1c95702a46 Mon Sep 17 00:00:00 2001 From: Yannis DOUMIR FERNANDES Date: Tue, 24 Oct 2023 09:09:03 +0200 Subject: [PATCH 10/16] =?UTF-8?q?Mise=20=C3=A0=20jour=20de=20'src/app/inte?= =?UTF-8?q?rface/interface=5Fresp.h'?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/app/interface/interface_resp.h | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/app/interface/interface_resp.h b/src/app/interface/interface_resp.h index 480a299..d62b642 100644 --- a/src/app/interface/interface_resp.h +++ b/src/app/interface/interface_resp.h @@ -1,4 +1,5 @@ void affichArticles( int tRef[], float tPoids[], float tVol[], float tPrix[], int tLogique); void affichUnArticle(int tRef[], float tPoids[], float tVol[], float tPrix[], int tLogique, int val); void affichUnClient(int tNumClient[], float tCagnotte[], int tSus[], int tLogique, int val); -void affichUnClients(int tNumClient[], float tCagnotte[], int tSus[], int tLogique, int val); \ No newline at end of file +void affichUnClients(int tNumClient[], float tCagnotte[], int tSus[], int tLogique, int val); +void affichAjoutArticle(int *ref, float *poids, float *volume, float *prix); \ No newline at end of file From 9d5b1d47cfaf4bf0471ce8ee1d1b610e0c22bd5e Mon Sep 17 00:00:00 2001 From: Yannis DOUMIR FERNANDES Date: Tue, 24 Oct 2023 09:13:03 +0200 Subject: [PATCH 11/16] =?UTF-8?q?Mise=20=C3=A0=20jour=20de=20'src/app/inte?= =?UTF-8?q?rface/interface=5Fresp.c'?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/app/interface/interface_resp.c | 34 +++++++++++++++++++++++++++++- 1 file changed, 33 insertions(+), 1 deletion(-) diff --git a/src/app/interface/interface_resp.c b/src/app/interface/interface_resp.c index 495d6a7..b1ef8ac 100644 --- a/src/app/interface/interface_resp.c +++ b/src/app/interface/interface_resp.c @@ -57,10 +57,42 @@ void affichAjoutArticle(int *ref, float *poids, float *volume, float *prix) { printf("Entrez la ref du nouveaux produit"); scanf("%d", ref); + if ( ref < 0 ) + { + while ( ref < 0 ) + { + printf("Entrez un nombre correct !"); + scanf("%d", ref); + } + } printf("Entrez le poids du nouveaux produit"); scanf("%f", poids); + if ( poids < 0 ) + { + while ( poids < 0 ) + { + printf("Entrez un nombre correct !"); + scanf("%d", poids); + } + } printf("Entrez le volume du nouveaux produit"); - scanf("%f", volume); + scanf("%f", poids); + if ( poids < 0 ) + { + while ( poids < 0 ) + { + printf("Entrez un nombre correct !"); + scanf("%d", poids); + } + } printf("Entrez le prix du nouveaux produit"); scanf("%f", prix); + if ( prix < 0 ) + { + while ( prix < 0 ) + { + printf("Entrez un nombre correct !"); + scanf("%d", prix); + } + } } \ No newline at end of file From 6253b94134511676aa9368ae05632c566f2479c6 Mon Sep 17 00:00:00 2001 From: Yannis DOUMIR FERNANDES Date: Tue, 24 Oct 2023 09:13:56 +0200 Subject: [PATCH 12/16] =?UTF-8?q?Mise=20=C3=A0=20jour=20de=20'src/app/core?= =?UTF-8?q?=5Flogic/responsable.h'?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/app/core_logic/responsable.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/app/core_logic/responsable.h b/src/app/core_logic/responsable.h index 4a9fffa..e862154 100644 --- a/src/app/core_logic/responsable.h +++ b/src/app/core_logic/responsable.h @@ -1,4 +1,4 @@ int chargementArticles(int tRef[], float tPoids[], float tVol[], float tPrix[], int tPhysique); -void sauvegadArticles(int tRef[], float tPoids[], float tVol[], float tPrix[], float tLogique); \ No newline at end of file +void sauvegadArticles(int tRef[], float tPoids[], float tVol[], float tPrix[], int tLogique); \ No newline at end of file From 1bd5e4a4f8fcb24c73ed6dbdc434155397c12ade Mon Sep 17 00:00:00 2001 From: Yannis DOUMIR FERNANDES Date: Tue, 24 Oct 2023 09:23:09 +0200 Subject: [PATCH 13/16] =?UTF-8?q?Mise=20=C3=A0=20jour=20de=20'src/app/core?= =?UTF-8?q?=5Flogic/responsable.c'?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/app/core_logic/responsable.c | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/src/app/core_logic/responsable.c b/src/app/core_logic/responsable.c index d6eeefd..27bccca 100644 --- a/src/app/core_logic/responsable.c +++ b/src/app/core_logic/responsable.c @@ -44,4 +44,22 @@ void sauvegadArticles(int tRef[], float tPoids[], float tVol[], float tPrix[], f } fclose(fe); +} + +int ajouterArticle( int tRef[], float tPoids[], float tVol[], float tPrix[], int *tLogique, int tPhysique, int ref, float poids, float volume, float prix) +{ + int i = *tLogique; + affichAjoutArticle(&ref, &poids, &volume, &prix); + if ( *tLogique == tPhysique) + { + fprintf(stderr,"Tableau plein !"); + return -2; + } + + // SI on trie pas par ref c'est ca + tRef[i] = ref; + tPoids[i] = poids; + tVol[i] = volume; + tPrix[i] = prix; + } \ No newline at end of file From 4e17746abb4748ca4b0527d16195957eb73d815a Mon Sep 17 00:00:00 2001 From: Yannis DOUMIR FERNANDES Date: Tue, 24 Oct 2023 09:23:28 +0200 Subject: [PATCH 14/16] =?UTF-8?q?Mise=20=C3=A0=20jour=20de=20'src/app/core?= =?UTF-8?q?=5Flogic/responsable.h'?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/app/core_logic/responsable.h | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/app/core_logic/responsable.h b/src/app/core_logic/responsable.h index e862154..b700dca 100644 --- a/src/app/core_logic/responsable.h +++ b/src/app/core_logic/responsable.h @@ -1,4 +1,5 @@ int chargementArticles(int tRef[], float tPoids[], float tVol[], float tPrix[], int tPhysique); -void sauvegadArticles(int tRef[], float tPoids[], float tVol[], float tPrix[], int tLogique); \ No newline at end of file +void sauvegadArticles(int tRef[], float tPoids[], float tVol[], float tPrix[], int tLogique); +int ajouterArticle( int tRef[], float tPoids[], float tVol[], float tPrix[], int *tLogique, int tPhysique, int ref, float poids, float volume, float prix); \ No newline at end of file From 91542d8c751d23c070d7b12878b00108f0e10276 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Math=C3=A9o=20Hersan?= Date: Tue, 24 Oct 2023 10:51:49 +0200 Subject: [PATCH 15/16] fixed some bugs on resp. Added global_resp and added error handling for char MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Mathéo Hersan --- app | Bin 0 -> 34816 bytes src/app/core_logic/responsable.c | 17 +++++---- src/app/core_logic/responsable.h | 4 +-- src/app/core_logic/testResponsable.c | 9 ----- src/app/interface/interface_client.c | 21 +++++------ src/app/interface/interface_client.h | 2 +- src/app/interface/interface_resp.c | 50 ++++++++++++++++++++++++--- src/app/interface/interface_resp.h | 4 ++- src/main.c | 4 +-- 9 files changed, 70 insertions(+), 41 deletions(-) create mode 100755 app diff --git a/app b/app new file mode 100755 index 0000000000000000000000000000000000000000..14066542b41932d54e2e70764fc447657eee5ed1 GIT binary patch literal 34816 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 S)xZAUQ0>=S)|LI@iT?()vehjB literal 0 HcmV?d00001 diff --git a/src/app/core_logic/responsable.c b/src/app/core_logic/responsable.c index 27bccca..802bd7f 100644 --- a/src/app/core_logic/responsable.c +++ b/src/app/core_logic/responsable.c @@ -1,5 +1,7 @@ #include +#include #include "responsable.h" +#include "../interface/interface_resp.h" int chargementArticles(int tRef[], float tPoids[], float tVol[], float tPrix[], int tPhysique) { @@ -27,22 +29,19 @@ int chargementArticles(int tRef[], float tPoids[], float tVol[], float tPrix[], return i; } -void sauvegadArticles(int tRef[], float tPoids[], float tVol[], float tPrix[], float tLogique) -{ +void sauvegardArticles(int tRef[], float tPoids[], float tVol[], float tPrix[], int tLogique){ int i; FILE * fe; - fe = fopen("articles.txt","w"); - if ( fe == NULL ) + fe = fopen("donnee/articles.txt", "w"); + if ( fe == NULL) { perror("fopen"); - return -1; + return; } - - for ( i = 0; i < tLogique; ++i) + for ( i = 0; i < tLogique; i++) { - fwritef(fe,"%d\t %.2f\t %.2f\t %.2f\n", ); + fprintf(fe,"%d %f %f %f\n", tRef[i], tPoids[i], tVol[i], tPrix[i]); } - fclose(fe); } diff --git a/src/app/core_logic/responsable.h b/src/app/core_logic/responsable.h index b700dca..4230671 100644 --- a/src/app/core_logic/responsable.h +++ b/src/app/core_logic/responsable.h @@ -1,5 +1,5 @@ - +#include int chargementArticles(int tRef[], float tPoids[], float tVol[], float tPrix[], int tPhysique); -void sauvegadArticles(int tRef[], float tPoids[], float tVol[], float tPrix[], int tLogique); +void sauvegardArticles(int tRef[], float tPoids[], float tVol[], float tPrix[], int tLogique); int ajouterArticle( int tRef[], float tPoids[], float tVol[], float tPrix[], int *tLogique, int tPhysique, int ref, float poids, float volume, float prix); \ No newline at end of file diff --git a/src/app/core_logic/testResponsable.c b/src/app/core_logic/testResponsable.c index 9759553..0b38a9a 100644 --- a/src/app/core_logic/testResponsable.c +++ b/src/app/core_logic/testResponsable.c @@ -1,12 +1,3 @@ #include #include "responsable.h" #include "../interface/interface_resp.h" - -int main (void) -{ - int tPhysique = 10, tRef[10], tLogique = 0; - float tPoids[10], tVol[10], tPrix[10]; - tLogique = chargementArticles( tRef, tPoids, tVol, tPrix, tPhysique); - affichArticles( tRef, tPoids, tVol, tPrix, tLogique); - return 0; -} \ No newline at end of file diff --git a/src/app/interface/interface_client.c b/src/app/interface/interface_client.c index 1718f20..4d14f45 100644 --- a/src/app/interface/interface_client.c +++ b/src/app/interface/interface_client.c @@ -20,30 +20,25 @@ void affiche_client(int a){ /* * Sert à lancer le menu et faire choisir l'utilisateur */ -void menu(int *choix, int jour) { +void menu_client(int *choix, int jour) { affiche_client(jour); printf("Vous choisissez: "); - scanf("%d", choix); - - while (*choix < 0) - { + while (scanf("%d", choix) != 1 || *choix < 0 || *choix > 5) { + while (getchar() != '\n'); // Nettoie le tampon d'entrée en cas de saisie invalide affiche_client(jour); - printf("Vous choisissez: "); - printf("Veuillez entrer un choix valide ! \n"); - scanf("%d", choix); + printf("Veuillez entrer un choix valide : "); } } -void global_client(){ +void global_client() { int choix, jour; - menu(&choix, jour); + menu_client(&choix, jour); switch (choix) { case 1: afficherDonneesClient(); break; default: - printf("Veuillez entrer un choix valide ! \n"); + printf("Veuillez entrer un choix valide !\n"); break; } -} - +} \ No newline at end of file diff --git a/src/app/interface/interface_client.h b/src/app/interface/interface_client.h index a361055..f091e36 100644 --- a/src/app/interface/interface_client.h +++ b/src/app/interface/interface_client.h @@ -1,5 +1,5 @@ #include void affiche_client(int a); -void menu(int *choix, int a); +void menu_client(int *choix, int a); void global_client(); \ No newline at end of file diff --git a/src/app/interface/interface_resp.c b/src/app/interface/interface_resp.c index b1ef8ac..d500cea 100644 --- a/src/app/interface/interface_resp.c +++ b/src/app/interface/interface_resp.c @@ -1,6 +1,22 @@ #include #include "interface_resp.h" +void affiche_resp(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 les articles \t \t \t \t || \n"); + printf("||\t2 : Afficher un article \t \t \t \t || \n"); + printf("||\t3 : Afficher un client \t \t \t \t \t || \n"); + printf("||\t4 : Afficher les clients \t \t \t \t || \n"); + printf("||\t5 : Réinitialiser le panier. \t \t \t \t || \n"); + printf("+-----------------------------------------------------------------+\n"); +} + void affichArticles( int tRef[], float tPoids[], float tVol[], float tPrix[], int tLogique) { int i; @@ -72,7 +88,7 @@ void affichAjoutArticle(int *ref, float *poids, float *volume, float *prix) while ( poids < 0 ) { printf("Entrez un nombre correct !"); - scanf("%d", poids); + scanf("%f", poids); } } printf("Entrez le volume du nouveaux produit"); @@ -82,7 +98,7 @@ void affichAjoutArticle(int *ref, float *poids, float *volume, float *prix) while ( poids < 0 ) { printf("Entrez un nombre correct !"); - scanf("%d", poids); + scanf("%f", poids); } } printf("Entrez le prix du nouveaux produit"); @@ -92,7 +108,33 @@ void affichAjoutArticle(int *ref, float *poids, float *volume, float *prix) while ( prix < 0 ) { printf("Entrez un nombre correct !"); - scanf("%d", prix); + scanf("%f", prix); } } -} \ No newline at end of file +} + + +void menu_resp(int *choix, int jour) { + affiche_resp(jour); + printf("Vous choisissez: "); + while (scanf("%d", choix) != 1 || *choix < 0 || *choix > 5) { + while (getchar() != '\n'); // Nettoie le tampon d'entrée en cas de saisie invalide + affiche_resp(jour); + printf("Veuillez entrer un choix valide : "); + } +} + +void global_resp(){ + int choix, a, tRef[100], tLogique = 0; + float tPoids[100], tVol[100], tPrix[100]; + menu_resp(&choix, a); + switch (choix) { + case 1: + affichArticles(tRef, tPoids, tVol, tPrix, tLogique); + break; + default: + printf("Veuillez entrer un choix valide ! \n"); + break; + } +} + diff --git a/src/app/interface/interface_resp.h b/src/app/interface/interface_resp.h index d62b642..6d7b724 100644 --- a/src/app/interface/interface_resp.h +++ b/src/app/interface/interface_resp.h @@ -2,4 +2,6 @@ void affichArticles( int tRef[], float tPoids[], float tVol[], float tPrix[], in void affichUnArticle(int tRef[], float tPoids[], float tVol[], float tPrix[], int tLogique, int val); void affichUnClient(int tNumClient[], float tCagnotte[], int tSus[], int tLogique, int val); void affichUnClients(int tNumClient[], float tCagnotte[], int tSus[], int tLogique, int val); -void affichAjoutArticle(int *ref, float *poids, float *volume, float *prix); \ No newline at end of file +void affichAjoutArticle(int *ref, float *poids, float *volume, float *prix); +void menu_resp(int *choix, int jour); +void global_resp(); diff --git a/src/main.c b/src/main.c index 106da06..aa376f5 100644 --- a/src/main.c +++ b/src/main.c @@ -15,7 +15,7 @@ int choixInterface(void) { fprintf(stderr,"Veuillez entrer un choix valide ! \n"); } switch (choix) { - case 1: printf("Vous avez choisit l'interface responsable.\n"); break; + case 1: printf("Vous avez choisit l'interface responsable.\n"); case 2: printf("Vous avez choisit l'interface client.\n"); } return choix; @@ -23,7 +23,7 @@ int choixInterface(void) { int main(){ switch (choixInterface()) { - //case 1: global_resp(); + case 1: global_resp(); case 2: global_client(); } return 0; From edeb00b697804fecaaaa0eb5e82d77a7f159e1cb Mon Sep 17 00:00:00 2001 From: "yannis.doumir_fernandes" Date: Sun, 29 Oct 2023 12:12:15 +0100 Subject: [PATCH 16/16] ADD function rechercheArticle + suprArticle + modifArticle + some interfaces function --- src/app/core_logic/responsable.c | 51 ++++++- src/app/core_logic/responsable.h | 5 +- src/app/core_logic/testResponsable.c | 8 + src/app/interface/interface_resp.c | 215 +++++++++++++++++++++------ src/app/interface/interface_resp.h | 7 +- 5 files changed, 234 insertions(+), 52 deletions(-) diff --git a/src/app/core_logic/responsable.c b/src/app/core_logic/responsable.c index 802bd7f..e708e59 100644 --- a/src/app/core_logic/responsable.c +++ b/src/app/core_logic/responsable.c @@ -29,7 +29,8 @@ int chargementArticles(int tRef[], float tPoids[], float tVol[], float tPrix[], return i; } -void sauvegardArticles(int tRef[], float tPoids[], float tVol[], float tPrix[], int tLogique){ +void sauvegardArticles(int tRef[], float tPoids[], float tVol[], float tPrix[], int tLogique) +{ int i; FILE * fe; fe = fopen("donnee/articles.txt", "w"); @@ -45,6 +46,8 @@ void sauvegardArticles(int tRef[], float tPoids[], float tVol[], float tPrix[], fclose(fe); } + + int ajouterArticle( int tRef[], float tPoids[], float tVol[], float tPrix[], int *tLogique, int tPhysique, int ref, float poids, float volume, float prix) { int i = *tLogique; @@ -60,5 +63,51 @@ int ajouterArticle( int tRef[], float tPoids[], float tVol[], float tPrix[], int tPoids[i] = poids; tVol[i] = volume; tPrix[i] = prix; + return 0; +} + +void rechercheRefArticle(int tRef[], int ref, int *index, int tLogique) +{ + for (int i = 0; i #include "responsable.h" #include "../interface/interface_resp.h" +#include "../interface/interface_client.h" + + +int main(void) +{ + global_resp(); + return 0; +} \ No newline at end of file diff --git a/src/app/interface/interface_resp.c b/src/app/interface/interface_resp.c index d500cea..4bea215 100644 --- a/src/app/interface/interface_resp.c +++ b/src/app/interface/interface_resp.c @@ -1,6 +1,31 @@ + #include +#include #include "interface_resp.h" +#include "app/core_logic/responsable.h" + +#define MAX_CLIENTS 100 +#define MAX_ARTICLES 100 + +void affiche_resp(void){ + 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 les articles \t \t \t \t || \n"); + printf("||\t2 : Afficher un article \t \t \t \t || \n"); + printf("||\t3 : Afficher un client \t \t \t \t \t || \n"); + printf("||\t4 : Afficher les clients \t \t \t \t || \n"); + printf("||\t5 : Supprimer un article \t \t \t \t || \n"); + printf("||\t6 : Modifier un article \t \t \t \t || \n"); + printf("||\t7 : Réinitialiser le panier. \t \t \t \t || \n"); + printf("+-----------------------------------------------------------------+\n"); +} +/* void affiche_resp(int a){ printf("\n"); printf("+-------------+ \n"); @@ -13,128 +38,222 @@ void affiche_resp(int a){ printf("||\t2 : Afficher un article \t \t \t \t || \n"); printf("||\t3 : Afficher un client \t \t \t \t \t || \n"); printf("||\t4 : Afficher les clients \t \t \t \t || \n"); - printf("||\t5 : Réinitialiser le panier. \t \t \t \t || \n"); + printf("||\t5 : Supprimer un article \t \t \t \t || \n"); + printf("||\t6 : Modifier un article \t \t \t \t || \n"); + printf("||\t7 : Réinitialiser le panier. \t \t \t \t || \n"); printf("+-----------------------------------------------------------------+\n"); } - +*/ void affichArticles( int tRef[], float tPoids[], float tVol[], float tPrix[], int tLogique) { - int i; - printf("______________________________________\n"); printf("\t Liste des articles \n\n"); - for ( i = 0; i < tLogique; ++i) + for ( int i = 0; i < tLogique; ++i) { printf("\t %d %.2f %.2f %.2f\n\n", tRef[i], tPoids[i], tVol[i], tPrix[i]); } } -void affichUnArticle(int tRef[], float tPoids[], float tVol[], float tPrix[], int tLogique, int val) +void affichUnArticle(int tRef[], float tPoids[], float tVol[], float tPrix[], int tLogique) { - int i; - for ( i = 0; i < tLogique; ++i) + int ref; + printf("\tQuelle est la référence de l'article à rechercher ?\n"); + while(scanf("%d", &ref != 1 || ref <= 0)) + { + printf("\tEntrez une référence valide\n"); + while(getchar() != '\n'); + } + for ( int i = 0; i < tLogique; ++i) { - if ( val == tRef[i] ) + if ( ref == tRef[i] ) { printf("\t %d %.2f %.2f %.2f\n\n", tRef[i], tPoids[i], tVol[i], tPrix[i]); return; } } - fprintf(stderr, "Article introuvable"); - printf("Article introuvable"); - return; + printf("\t Article introuvable\n"); } -void affichUnClient(int tNumClient[], float tCagnotte[], int tSus[], int tLogique, int val) +void affichUnClient(int tNumClient[], float tCagnotte[], int tSus[], int tLogique) { - int i; - for ( i = 0; i < tLogique; ++i) + int numC; + printf("\tVeuillez entrer le numéro du client à rechercher\n"); + while(scanf("%d", &numC) != 1 || numC <= 0) { - if ( val == tNumClient[i] ) + printf("\t Veuillez entrez un numéro valide !\n"); + while(getchar() != '\n'); + } + for ( int i = 0; i < tLogique; ++i) + { + if ( numC == tNumClient[i] ) { printf("\t %d %.2f %d\n\n", tNumClient[i], tCagnotte[i], tSus[i]); + return; } } - fprintf(stderr, "Client introuvable"); - printf("Client introuvable"); + printf("Client introuvable\n"); } -void affichUnClients(int tNumClient[], float tCagnotte[], int tSus[], int tLogique, int val) +void affichClients(int tNumClient[], float tCagnotte[], int tSus[], int tLogique) { - int i; - for ( i = 0; i < tLogique; ++i) + printf("\t Liste des clients\n"); + for ( int i = 0; i < tLogique; ++i) { printf("\t %d %.2f %d\n\n", tNumClient[i], tCagnotte[i], tSus[i]); } - fprintf(stderr, "Client introuvable"); - printf("Client introuvable"); + printf("\t Fin de la liste ! \n"); } void affichAjoutArticle(int *ref, float *poids, float *volume, float *prix) { - printf("Entrez la ref du nouveaux produit"); + printf("Entrez la ref du nouveaux produit\n"); scanf("%d", ref); - if ( ref < 0 ) + if ( *ref < 0 ) { - while ( ref < 0 ) + while ( *ref < 0 ) { - printf("Entrez un nombre correct !"); + printf("Entrez un nombre correct !\n"); scanf("%d", ref); } } - printf("Entrez le poids du nouveaux produit"); + printf("Entrez le poids du nouveaux produit\n"); scanf("%f", poids); - if ( poids < 0 ) + if ( *poids < 0 ) { - while ( poids < 0 ) + while ( *poids < 0 ) { - printf("Entrez un nombre correct !"); + printf("Entrez un nombre correct !\n"); scanf("%f", poids); } } - printf("Entrez le volume du nouveaux produit"); - scanf("%f", poids); - if ( poids < 0 ) + printf("Entrez le volume du nouveaux produit\n"); + scanf("%f", volume); + if ( *volume < 0 ) { - while ( poids < 0 ) + while ( *volume < 0 ) { - printf("Entrez un nombre correct !"); + printf("Entrez un poids correct !\n"); scanf("%f", poids); } } - printf("Entrez le prix du nouveaux produit"); + printf("Entrez le prix du nouveaux produit\n"); scanf("%f", prix); - if ( prix < 0 ) + if ( *prix < 0 ) { - while ( prix < 0 ) + while ( *prix < 0 ) { - printf("Entrez un nombre correct !"); + printf("Entrez un prix correct !\n"); scanf("%f", prix); } } } + +void affichSupprimerArticle(int *ref) +{ + printf("\t Quel est la référence de l'article voulez-vous supprimez\n"); + while(scanf("%d", ref == 1 || *ref <= 0)) + { + printf("\t Veuillez entrer une référence valide.") + while(getchar() != '\n'); + } +} + +void affichModifierArticle(int *ref, float *poids, float *volume, float *prix) +{ + + + printf("\t Quel est la référence de l'article voulez-vous modifier ?\n"); + while(scanf("%d", ref) != 1 || *ref <=0) + { + printf("\tVeuillez entrer une référence correcte !\n"); + while (getchar() != '\n'); + } + + printf("\t Quel est le nouveau poids à entrer ?\n"); + while(scanf("%f", poids) != 1 || *poids <= 0) + { + printf("\t Veuillez entrer un poids correct !"); + while (getchar() != '\n'); + } + + printf("\t Quel est le nouveau volume à entrer ?\n"); + while(scanf("%f", volume) != 1 || *volume <= 0) + { + printf("\t Veuillez entrer un volume correct !"); + while (getchar() != '\n'); + } + + printf("\t Quel est le nouveau prix à entrer ?\n"); + while(scanf("%f", prix) != 1 || *prix <= 0) + { + printf("\t Veuillez entrer un prix correct !"); + while (getchar() != '\n'); + } +} + +/* void menu_resp(int *choix, int jour) { - affiche_resp(jour); + affiche_resp(); + //affiche_resp(jour); printf("Vous choisissez: "); while (scanf("%d", choix) != 1 || *choix < 0 || *choix > 5) { - while (getchar() != '\n'); // Nettoie le tampon d'entrée en cas de saisie invalide + while (getchar() != '\n'); affiche_resp(jour); printf("Veuillez entrer un choix valide : "); } } +*/ + +void menu_resp(int *choix) { + affiche_resp(); + //affiche_resp(jour); + printf("Vous choisissez: "); + while (scanf("%d", choix) != 1 || *choix < 0 || *choix > 5) { + while (getchar() != '\n'); + affiche_resp(); + printf("Veuillez entrer un choix valide : "); + } +} void global_resp(){ - int choix, a, tRef[100], tLogique = 0; - float tPoids[100], tVol[100], tPrix[100]; - menu_resp(&choix, a); + int choix, a; + int tRef[MAX_ARTICLES]; + float tPoids[MAX_ARTICLES]; + float tVol[MAX_ARTICLES]; + float tPrix[MAX_ARTICLES]; + int tNumClient[MAX_CLIENTS]; + float tCagnotte[MAX_CLIENTS]; + int tSus[MAX_CLIENTS]; + + int tLogArticle = chargementArticles(tRef, tPoids, tVol, tPrix, MAX_ARTICLES); + //int tLogClient = charger_clients(tNumClient, tCagnotte, tSus, MAX_CLIENTS); + + menu_resp(&choix); switch (choix) { case 1: - affichArticles(tRef, tPoids, tVol, tPrix, tLogique); + affichArticles(tRef, tPoids, tVol, tPrix, tLogArticle); + break; + case 2: + affichUnArticle(tRef, tPoids, tVol, tPrix, tLogArticle); + break; + case 3: + affichUnClient(tNumClient, tCagnotte, tSus, tLogClient); + break; + case 4: + affichClients(tNumClient, tCagnotte, tSus, tLogClient); + break; + case 5: + modifierArticle(tRef, tPoids, tVol, tPrix, tLogArticle); + break; + case 6: + supprimerArticle(tRef, tPoids, tVol, tPrix, &tLogArticle); + break; + case 7: + printf("Ouai tkt ^^'"); break; default: printf("Veuillez entrer un choix valide ! \n"); break; } -} - +} \ No newline at end of file diff --git a/src/app/interface/interface_resp.h b/src/app/interface/interface_resp.h index 6d7b724..598244b 100644 --- a/src/app/interface/interface_resp.h +++ b/src/app/interface/interface_resp.h @@ -1,7 +1,10 @@ void affichArticles( int tRef[], float tPoids[], float tVol[], float tPrix[], int tLogique); void affichUnArticle(int tRef[], float tPoids[], float tVol[], float tPrix[], int tLogique, int val); -void affichUnClient(int tNumClient[], float tCagnotte[], int tSus[], int tLogique, int val); -void affichUnClients(int tNumClient[], float tCagnotte[], int tSus[], int tLogique, int val); +void affichUnClient(int tNumClient[], float tCagnotte[], int tSus[], int tLogique); +void affichClients(int tNumClient[], float tCagnotte[], int tSus[], int tLogique); void affichAjoutArticle(int *ref, float *poids, float *volume, float *prix); +void affichSupprimerArticle(int *ref); +void affichModifierArticle(int *ref, float *poids, float *volume, float *prix); void menu_resp(int *choix, int jour); void global_resp(); +void affiche_resp(void);