Révision 260
Ajouté par dgmbadinga il y a presque 4 ans
branch/MBADINGA/sp4a12/main.c | ||
---|---|---|
"$GPZDA,141914.00,01,02,2006,00,00*69",
|
||
0};
|
||
|
||
int trame_cmp(char* trame,char* identif){
|
||
int trame_cmp(char* trame,char* type){
|
||
|
||
int i,ok=0, taille=0;
|
||
while (identif[taille]!='\0') /* Determination de la taille de la chaine identif (GP...)*/
|
||
while (type[taille]!='\0') /* Determination de la taille de la chaine identif (GP...)*/
|
||
{
|
||
taille++;
|
||
}
|
||
for (i=0; i<taille; i++ )
|
||
{
|
||
if (trame[i+1]==identif[i]) /* compare les chaines de caract?res ?l?ments par ?lement */
|
||
if (trame[i+1]==type[i]) /* compare les chaines de caract?res ?l?ments par ?lement */
|
||
{
|
||
ok=1; /* si ?galit? ok = 1 */
|
||
}
|
||
... | ... | |
}
|
||
return ok; /* la fonction renvois la valeur 1 si la trame commence par la chaine de caret?re identif et 0 sinon */
|
||
}
|
||
|
||
int decode_int (char c){
|
||
|
||
int a=0;
|
||
if (c>=48 && c<=57)
|
||
{
|
||
a=c-48;
|
||
}
|
||
|
||
return a;
|
||
}
|
||
|
||
/* Fonction ? modifier !!!!!*/
|
||
|
||
... | ... | |
exit(-1);
|
||
}
|
||
}
|
||
|
||
void test_decode_int(void)
|
||
{
|
||
if (decode_int(0)!=0)
|
||
printf("Erreur ecriture fonction decode_int\n");
|
||
}
|
||
|
||
|
||
/* Ne pas modifier cette fonction*/
|
||
|
Formats disponibles : Unified diff
Q.7 TP1: Implanter la fonction decode_int(), écrire un test unitaire test_decode_int(void) de decode_int()