advanced julian date calculator

I thought I did it all right until i compiled.
It thinks the formula is multiple functions
so help if you can.

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
#include <iostream> // cin and cout (main funct for that lib)
#include "std_lib_facilities.h" // libs like cmath and algorithem
#define new '\n'
using namespace std; 
double M,Y,D,MN,H,S,X,Z; //M = months Y = years D = days MN = minutes H = hours S = seconds X = JDN Z= JDN and ToD
// JDN = Julian date number ToD = Time of day... the variable Z is the jdn given the time of day
int main() 
{
    cout << "Age calc" << new;
    cout << new;
    cout << "The day You were born" << new;
    cout << new;
    cin >> D;
    cout << "The Month You were born" << new;
    cin >> M;
    cout << "The Year You were born" << new;
    cin >> Y;
    out << "The Hour You were born" << new;
    cout << new;
    cin >> D;
    cout << "The Minute You were born" << new;
    cin >> M;
    cout << "The Second You were born" << new;
    cin >> Y;
    cout << new;
    cout << new;
    



x = (1461 × (Y + 4800 + (M - 14)/12))/4 +(367 × (M - 2 - 12 × ((M - 14)/12)))/12 - (3 × ((Y + 4900 + (M - 14)/12)/100))/4 + D - 32075
Z = X + ((H-12)/24) + (MN/1440) + (S/86400)
cout << Z << new;
 system ("PAUSE");
return 0;
}


and please don't complain about me declaring a already key word...
Last edited on
× is not a valid C++ operator, replace it with *

and please don't complain about me declaring a already key word...
Do you know about endl?
Why shouldn't we complain about that? You should decidedly not be overwriting the name of an operator for a constant. As Bazzy noted, use endl instead, which appends a newline and flushes.
is endl a key word???
and how would i replace x with with a mathmatical operator. X is my variable. Doesn't the operator * multiply things???
Edit... Oh i see. you mean the formula...
yeah i copied and pasted that...
Last edited on
endl is an I/O manipulator declared in the std namespace.


Also, you really don't want to do this in C++ since new is a keyword:

#define new '\n'
Topic archived. No new replies allowed.