Révision 356
Ajouté par Lilian MEMBRE il y a presque 3 ans
branch/MEMBRE/sp4a12/main.c | ||
---|---|---|
if (n==9)
|
||
{
|
||
degree = ((l[0]-48)*10+(l[1]-48));
|
||
minutes = ((l[2]-48)*10+(l[3]-48)+(l[4]-48)*0.1+(l[5]-48)*0.01+(l[6]-48)*0.001+(l[7]-48)*0.0001+(l[8]-48)*0.00001);
|
||
minutes = ((l[2]-48)*10+(l[3]-48)+(l[5]-48)*0.1+(l[6]-48)*0.01+(l[7]-48)*0.001+(l[8]-48)*0.0001);
|
||
lati = degree + minutes/60;
|
||
}
|
||
else
|
||
{
|
||
printf("Erreur de saisie");
|
||
}
|
||
lati = degree + minutes/60;
|
||
return lati;
|
||
}
|
||
|
||
|
||
// Fonction longitude en nombre flotttant
|
||
|
||
int longitude(char l[])
|
||
{
|
||
int n=0;
|
||
int degree=0;
|
||
int minutes=0;
|
||
int longi=0;
|
||
|
||
|
||
while (l[n]!='\0')
|
||
{
|
||
n=n+1;
|
||
}
|
||
if (n==10)
|
||
{
|
||
degree = ((l[0]-48)*100+(l[1]-48)*10+(l[2]-48));
|
||
minutes = ((l[3]-48)*10+(l[4]-48)+(l[6]-48)*0.1+(l[7]-48)*0.01+(l[8]-48)*0.001+(l[9]-48)*0.0001);
|
||
longi = degree + minutes/60;
|
||
}
|
||
else
|
||
{
|
||
printf("Erreur de saisie");
|
||
}
|
||
return longi;
|
||
}
|
||
//Test de latitude
|
||
|
||
int test_latitude()
|
||
{
|
||
if (latitude("3723.2475")-37.387458<0.000001)
|
||
if (latitude("3723.2475")-37.387458<0.000001&& 37.387458-latitude("3723.2475")<0.000001)
|
||
{
|
||
printf("Erreur test latitude");
|
||
exit(-1);
|
||
}
|
||
}
|
||
|
||
|
||
//Test de longitude
|
||
|
||
int test_longitude()
|
||
{
|
||
if (longitude("00306.6036")-37.387458<0.000001 && 37.387458-latitude("00306.6036")<0.000001)
|
||
{
|
||
printf("Erreur test latitude");
|
||
exit(-1);
|
||
}
|
||
}
|
||
|
||
//Fonction ? modifier !!!!!
|
||
void traitement(char * trame)
|
||
... | ... | |
{
|
||
printf("Erreur test latitude");
|
||
exit(-1);
|
||
}
|
||
/* test longitude */
|
||
if (longitude("00306.6036")-37.387458<0.000001 && 37.387458-latitude("00306.6036")<0.000001)
|
||
{
|
||
printf("Erreur test latitude");
|
||
exit(-1);
|
||
}
|
||
}
|
||
}
|
||
|
||
|
||
|
||
// Ne pas modifier cette fonction
|
||
int main(int argc,char ** argv)
|
Formats disponibles : Unified diff
test longitude ok et quelques modif latitude