Added td8

This commit is contained in:
Yohan Boujon 2020-09-12 18:34:43 +02:00
parent 94de39f68c
commit 5c1065510e
4 changed files with 131 additions and 0 deletions

68
td8/main.c Executable file
View file

@ -0,0 +1,68 @@
#include <stdio.h>
#include <stdlib.h>
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];
};
}
}

44
td8/tp8info.cbp Executable file
View file

@ -0,0 +1,44 @@
<?xml version="1.0" encoding="UTF-8" standalone="yes" ?>
<CodeBlocks_project_file>
<FileVersion major="1" minor="6" />
<Project>
<Option title="tp8info" />
<Option pch_mode="2" />
<Option compiler="gcc" />
<Build>
<Target title="Debug">
<Option output="bin/Debug/tp8info" prefix_auto="1" extension_auto="1" />
<Option object_output="obj/Debug/" />
<Option type="1" />
<Option compiler="gcc" />
<Compiler>
<Add option="-g" />
</Compiler>
</Target>
<Target title="Release">
<Option output="bin/Release/tp8info" prefix_auto="1" extension_auto="1" />
<Option object_output="obj/Release/" />
<Option type="1" />
<Option compiler="gcc" />
<Compiler>
<Add option="-O2" />
</Compiler>
<Linker>
<Add option="-s" />
</Linker>
</Target>
</Build>
<Compiler>
<Add option="-Wall" />
</Compiler>
<Unit filename="main.c">
<Option compilerVar="CC" />
</Unit>
<Extensions>
<code_completion />
<envvars />
<debugger />
<lib_finder disable_auto="1" />
</Extensions>
</Project>
</CodeBlocks_project_file>

9
td8/tp8info.depend Executable file
View file

@ -0,0 +1,9 @@
# depslib dependency file v1.0
1610729332 source:z:\info1\tp8info\tp8info\main.c
<stdio.h>
<stdlib.h>
1610896051 source:c:\users\alzyohan\desktop\tp8info\tp8info\main.c
<stdio.h>
<stdlib.h>

10
td8/tp8info.layout Executable file
View file

@ -0,0 +1,10 @@
<?xml version="1.0" encoding="UTF-8" standalone="yes" ?>
<CodeBlocks_layout_file>
<FileVersion major="1" minor="0" />
<ActiveTarget name="Debug" />
<File name="main.c" open="0" top="0" tabpos="1" split="0" active="1" splitpos="0" zoom_1="0" zoom_2="0">
<Cursor>
<Cursor1 position="1666" topLine="32" />
</Cursor>
</File>
</CodeBlocks_layout_file>