Dev - C++ - Fases lunares

 
Vista:

Fases lunares

Publicado por Ephesia (1 intervención) el 14/09/2012 13:36:50
Estimados foreros:

Tengo el código para cálculo de fases lunares en C++ y lo tengo que pasar a C#
¿Alguien me puede echar una mano?

no entiendo
algunas cosas del C++.

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
#include<iostream.h>
#include<math.h>
#include<conio.h>
void main()
{
clrscr();
int y,m,d;
 
int p2=2*3.14159;
cout<<"ingresa año,mes,dia:";
cin>>y>>m>>d;
int yy=y-(12-m)/10;
int mm=m+9;
 
if(mm>=12) mm=mm-12;
 
int k1=(int)(365.25*(yy+4712));
int k2=(int)(30.6*mm+0.5);
int k3=(int)((int)((yy/100)+49)*0.75)-38;
long j=k1+k2+d+59;
 
if (j>2299160) j=j-k3;
 
double v=(j-2451550.1)/29.530588853;
double ip=v;
ip=v-(int)(v);
 
if(ip<0) ip=ip+1;
 
double ag=ip*29.53;
ip=ip*p2;
 
v=(j-2451562.2)/27.55454988;
double dp=v;
 
if(dp<0) dp=dp+1;
dp=dp*p2;
double di=60.4-3.3*cos(dp)-0.6*cos(2*ip-dp)-0.5*cos(2*ip);
 
v=(j-2451565.2)/27212220817;
double np=v;
 
if(np<0) np=np+1;
 
np=np*p2;
double la=5.1*sin(np);
 
v=(j-2451555.8)/27.321582241;
double rp=v;
 
if(rp<0) rp=rp+1;
 
double lo=360*rp+6.3*sin(dp)+1.3*sin(2*ip-dp)+0.7*sin(2*ip);
 
cout<<ag<<endl;
cout<<di<<endl;
cout<<la<<endl;
cout<<lo<<endl;
 
getch();
}
Valora esta pregunta
Me gusta: Está pregunta es útil y esta claraNo me gusta: Está pregunta no esta clara o no es útil
0
Responder