Bonjour,

J'ai besoin d'aide pour corriger l'appel de fonctions du code suivant:
il s'agit d'afficher les valeurs de lon et r en appelant la fonction sunpos.
Merci.

Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
 
 
#include<stdio.h>
#include<math.h>
 
 
//Constantes
#define PI        3.1415926535897932384
#define RADEG     ( 180.0 / PI )
#define DEGRAD    ( PI / 180.0 )
 
//Fonctions trigo. en degrés
#define sind(x)  sin((x)*DEGRAD)
#define cosd(x)  cos((x)*DEGRAD)
#define tand(x)  tan((x)*DEGRAD)
 
#define atand(x)    (RADEG*atan(x))
#define asind(x)    (RADEG*asin(x))
#define acosd(x)    (RADEG*acos(x))
#define atan2d(y,x) (RADEG*atan2(y,x))
 
//Prototypes
void sunpos( double d, double *lon, double *r );
double revolution( double x );
 
 
 
main(void)
{
//pour d=0 la fonction doit retourner lon et r.
double d=0;	
double lon,r;
sunpos(d,&lon,&r);
 
printf("longitude: % .f\n",&lon);
printf("rayon vecteur: % .f\n", &r);
 
}
 
 
void sunpos( double d, double *lon, double *r )
 
{
      double M,w,e,E,x,y,v; 
 
 
      M = revolution( 356.0470 + 0.9856002585 * d );
      w = 282.9404 + 4.70935E-5 * d;
      e = 0.016709 - 1.151E-9 * d;
 
 
      E = M + e * RADEG * sind(M) * ( 1.0 + e * cosd(M) );
      x = cosd(E) - e;
      y = sqrt( 1.0 - e*e ) * sind(E);
      *r = sqrt( x*x + y*y );              
      v = atan2d( y, x );                  
      *lon = v + w;                        
      if ( *lon >= 360.0 )
      *lon -= 360.0;                   
}
 
 
#define INV360    ( 1.0 / 360.0 )
 
double revolution( double x )
 
{
      return( x - 360.0 * floor( x * INV360 ) );
}