Nantes Université

Skip to content
Extraits de code Groupes Projets
Valider fc9303dd rédigé par Florian HENNAUX's avatar Florian HENNAUX
Parcourir les fichiers

premier_transfert

parent 1126c581
Aucune branche associée trouvée
Aucune étiquette associée trouvée
Aucune requête de fusion associée trouvée
hello: main.o hello.o traduction.o
gcc -o $@ main.o hello.o traduction.o
main.o : main.c hello.h langues.h
gcc -c main.c
hello.o: hello.c langues.h traduction.h hello.h
gcc -c hello.c
traduction.o: traduction.c traduction.h langues.h
gcc -c traduction.c
#include <stdio.h>
#include "langues.h"
#include "traduction.h"
void dire_bonjour(FILE *stream, const char *const nom, langue lng)
{
fprintf(stream, "%s %s !\n", traduire_bonjour(lng), nom);
}
#ifndef _HELLO_H_
#define _HELLO_H_
#include "langues.h"
extern void dire_bonjour(FILE *stream, const char *const nom, langue lng);
#endif // _HELLO_H_
#include <stdio.h>
#include "hello.h"
int main(int argc, char *argv[])
{
if (argc != 3) {
printf ("Veuillez entrer un nom et une langue.\n");
return 1;
}
dire_bonjour(stdout,argv[1],string_vers_langue(argv[2]));
return 0;
}
#include <stdio.h>
#include "traduction.h"
const char* traduire_bonjour(langue lng)
{
switch (lng) {
case anglais:
return "Hello";
case francais:
return "Bonjour";
case neerlandais:
return "Hallo";
case allemand:
return "Guten Tag";
default:
return "?????";
}
}
langue string_vers_langue(const char *const str)
{
if (!strcmp(str,"anglais")) {
return anglais;
}
if (!strcmp(str,"francais")) {
return francais;
}
if (!strcmp(str,"neerlandais")) {
return neerlandais;
}
if (!strcmp(str,"allemand")) {
return allemand;
}
return inconnu;
}
#ifndef _TRADUCTION_H_
#define _TRADUCTION_H_
#include "langues.h"
extern const char *traduire_bonjour(langue lng);
extern langue string_vers_langue(const char *const str);
#endif // _TRADUCTION_H_
0% Chargement en cours ou .
You are about to add 0 people to the discussion. Proceed with caution.
Veuillez vous inscrire ou vous pour commenter