User Name Password Register
DaniWeb IT Discussion Community
All
What is DaniWeb IT Discussion Community?
You're currently browsing the C++ section within the Software Development category of DaniWeb, a massive community of 426,902 software developers, web developers, Internet marketers, and tech gurus who are all enthusiastic about making contacts, networking, and learning from each other. In fact, there are 2,371 IT professionals currently interacting right now! Registration is free, only takes a minute and lets you enjoy all of the interactive features of the site.
Please support our C++ advertiser: Programming Forums
Views: 2247 | Replies: 1
Reply
Join Date: Dec 2004
Posts: 11
Reputation: jtxay is an unknown quantity at this point 
Rep Power: 4
Solved Threads: 0
jtxay jtxay is offline Offline
Newbie Poster

Need help With this C++ Program..Confused..

  #1  
Dec 1st, 2004
Okay well i'm having trouble understanding this program ..in which our professor doesn't even explain..I'm so lost..
I hope somebody can help me please..
here's the problem...

I have to write a program in c++ that computes the number of days between two dates using the Julian day number which is the number of days that have elapsed since noon on jan 1, 4713 B.C , so i have to use the julian day number for each date and subtract one from the other.
This algorithm might help.. So given the year (an integer such as 2001), month (an integer from 1 to 12 ), and day ( an integer from 1 through 31), so if month is 1 or 2, then subtract 1 from year and add 12 to month.

If the date comes from the Gregorian calender (later than Oct 15, 1582), then compute an intermediate result with the following formula (otherwise, let intRes1 equal 0):

intRes1 = 2 - year/100+year/400 (integer division)

compute a second intermediate result with the formula

intRes2 = int(365.25 * year)

compute a third intermediate result with the formula

intRes3 = int(30.6001 * (month + 1))

Finally, the Julian day number is computed with the formula
julianDay = intRes1 + intRes2 + intRes3 + day + 1720994.5

So my program should make appropriate use of value-returning functions in solving this problem. integer type long and floating point type double may have to be used. Also it should prompt appropriately for input (the two dates) if it is to be run interactively. also it has to use proper style and comments.
so i have to make up my own test data and be ready to explain rationale behind my choice.
AND thats the situation..I am so stacked and i hope somebody can help me out ..Well thanks for your time and hopefully i can get this problem solved .. I really appreciate your help and dedication.. Thanks again.
AddThis Social Bookmark Button
Reply With Quote  
Join Date: Nov 2004
Location: Netherlands
Posts: 5,752
Reputation: jwenting is a jewel in the rough jwenting is a jewel in the rough jwenting is a jewel in the rough jwenting is a jewel in the rough 
Rep Power: 18
Solved Threads: 199
Colleague
jwenting's Avatar
jwenting jwenting is offline Offline
duckman

Re: Need help With this C++ Program..Confused..

  #2  
Dec 2nd, 2004
I think it's explained pretty well what the program should do. Just read more carefully...
Reply With Quote  
Reply

Only community members can participate in forum threads. You must register or log in to contribute.

DaniWeb C++ Marketplace
Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)

 

Thread Tools Display Modes

Similar Threads
Other Threads in the C++ Forum

All times are GMT -4. The time now is 11:12 am.
Forum system based on vBulletin Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
©2003 - 2008 DaniWeb® LLC