From 5c1065510e6d1f818bd201afde23b702a9666749 Mon Sep 17 00:00:00 2001 From: Yohan Boujon Date: Sat, 12 Sep 2020 18:34:43 +0200 Subject: [PATCH] Added td8 --- td8/main.c | 68 ++++++++++++++++++++++++++++++++++++++++++++++ td8/tp8info.cbp | 44 ++++++++++++++++++++++++++++++ td8/tp8info.depend | 9 ++++++ td8/tp8info.layout | 10 +++++++ 4 files changed, 131 insertions(+) create mode 100755 td8/main.c create mode 100755 td8/tp8info.cbp create mode 100755 td8/tp8info.depend create mode 100755 td8/tp8info.layout diff --git a/td8/main.c b/td8/main.c new file mode 100755 index 0000000..bc45bab --- /dev/null +++ b/td8/main.c @@ -0,0 +1,68 @@ +#include +#include + +typedef struct billet +{ + unsigned short depart; + unsigned short arrivee; + unsigned short type; +} BILLET; + +typedef enum +{ + ALLER_SIMPLE = 1<<0, + PREMIERE = 1<<1, + ECHANGEABLE = 1<<2, + FUMEUR = 1<<3, + SENIOR = 1<<4, + ADULTE = 1<<5, + JEUNE = 1<<6, + ENFANT = 1<<7, + BEBE = 1<<8, + REDUCTION = 1<<9, + SPECIAL = 1<<10, +} CRITERE; + +void billetconstruct (BILLET *construct, char* message[]); + +int main() +{ + char * message []= {"Aller-simple","Une premiere classe","Billet echangeable",\ + "Fumeur","Senior","Adulte ","Jeune","Enfant","Bebe",\ + "Reduction particuliere","Situation Speciale"}; + BILLET billet1; + printf("Indiquez le numero de la ville de depart : "); + scanf("%hd", &billet1.depart); + printf("Indiquez le numero de laville d'arrivee : "); + scanf("%hd", &billet1.arrivee); + fflush(stdin); + billet1.type=0; + billetconstruct(&billet1, message); + + printf("\n\nRecapitulatif :\nDepart : %d Arrivee : %d \n", billet1.depart, billet1.arrivee); + if((billet1.type & ALLER_SIMPLE) != 0) + { + printf("%s\n", message[0]); + } + else + { + printf("Aller-retour\n"); + }; + return 0; +} + +void billetconstruct (BILLET *construct, char* message[]) +{ + char choix; + int i; + for(i=0; i<10; i++) + { + printf("%s ? (o/n) : ", message[i]); + choix=getchar(); + fflush(stdin); + if(choix == 'o') + { + (*construct).type = (*construct).type ^ (*construct).type[i]; + }; + } +} diff --git a/td8/tp8info.cbp b/td8/tp8info.cbp new file mode 100755 index 0000000..b7450f8 --- /dev/null +++ b/td8/tp8info.cbp @@ -0,0 +1,44 @@ + + + + + + diff --git a/td8/tp8info.depend b/td8/tp8info.depend new file mode 100755 index 0000000..2bbc334 --- /dev/null +++ b/td8/tp8info.depend @@ -0,0 +1,9 @@ +# depslib dependency file v1.0 +1610729332 source:z:\info1\tp8info\tp8info\main.c + + + +1610896051 source:c:\users\alzyohan\desktop\tp8info\tp8info\main.c + + + diff --git a/td8/tp8info.layout b/td8/tp8info.layout new file mode 100755 index 0000000..29f698c --- /dev/null +++ b/td8/tp8info.layout @@ -0,0 +1,10 @@ + + + + + + + + + +