Révision 188
Ajouté par Abdou FAYE il y a environ 3 ans
main.c | ||
---|---|---|
if (c<'0' || c>'9'){
|
||
return -1;
|
||
}
|
||
return -1;
|
||
return c - '0';
|
||
}
|
||
int decode_nombre(char * ch, int n){
|
||
int i;
|
||
int res = 0;
|
||
for(i=0; i<n; i++){
|
||
res *= 10;
|
||
res += decode_int(ch[i]);
|
||
}
|
||
return res;
|
||
}
|
||
//Fonction ? modifier !!!!!
|
||
void traitement(char * trame)
|
||
... | ... | |
printf ("Erreur Test unitaire decode_int.\n");
|
||
exit(-1);
|
||
}
|
||
if (decode_nombre("123",3)!=123){
|
||
printf ("Erreur Test unitaire decode_nombre.\n");
|
||
exit(-1);
|
||
}
|
||
if (decode_nombre("7541",2)!=75){
|
||
printf ("Erreur Test unitaire decode_nombre.\n");
|
||
exit(-1);
|
||
}
|
||
|
||
}
|
||
|
Formats disponibles : Unified diff
ajout de la fonction decode nombre