| | |
Need help With this C++ Program..Confused..
![]() |
•
•
Join Date: Dec 2004
Posts: 11
Reputation:
Solved Threads: 0
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.
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. ![]() |
Similar Threads
- Countdown program (C++)
- Confused on how to finish Tic Tac Toe program. (C++)
- leap year program (C++)
- need help on simple turbo C program.. thx (C)
- Need help writing a switch program for class (C++)
- Just Starting. Confused. (C++)
- Unexpected output when program exucuted (C++)
- writing a simple cat program (C)
Other Threads in the C++ Forum
- Previous Thread: need help with arrays
- Next Thread: need help on corporate sales program
| Thread Tools | Search this Thread |
ace_thread api array assignment based binary bitmap borland c++ c++endcode c/c++ char class classes code coding compile connect console conversion count delete delete-line deploy desktop developer directshow dll download dynamic dynamiccharacterarray email embedded encryption error file forms fstream function functions game givemetehcodez graph gui homeworkhelp homeworkhelper iamthwee ifstream information input int integer java lib linkedlist linker loop looping loops map math mathhomeworkhelp matrix memory multidimensional multiple news node output pointer problem program programming project python random read recursion reference remote reverse richedit rpg string strings temperature template test text text-file tree url variable vector video win32 windows winsock wordfrequency wxwidgets






