Dismiss Notice
Join Physics Forums Today!
The friendliest, high quality science and math community on the planet! Everyone who loves science is here!

A C problem

  1. Aug 21, 2005 #1
    One of the problems on pointers in my textbook is this:

    Create a program that would convert a julian day and given year, and convert it to the mouth and date of that year.

    How to do this problem?

    Solution is in the form of pseudocode
     
    Last edited: Aug 22, 2005
  2. jcsd
  3. Aug 22, 2005 #2
    What do you have to show us as far as the work you have done so far?
     
  4. Aug 22, 2005 #3

    well, this is summer so there is really no school. I am just trying to make friend with that textbook. It is not an assignement, so there is really no requirement. In fact, i don t even know were to find a solfwere where i can create the source code and run it( perhaps you can help?).
     
  5. Aug 22, 2005 #4
  6. Aug 22, 2005 #5
    That s a great link , thank you.
     
  7. Aug 22, 2005 #6
    Install Debian Linux or Fedora Linux. all the dev tools you ned are right there.

    Dev-C++ is good, but it seems to have been unmaintained since before I had used it 4 years ago.
     
  8. Aug 22, 2005 #7
    Its better than switching platforms entirely
     
  9. Aug 22, 2005 #8
    :-)

    That is debatable :-p

    Personally, I find that the time I spent learning to use Linux was time well spent because I have discovered just how inefficient Windows is as far as getting work done.

    but this should not turn into an OS flame fest.

    it is just to bad that on windows there are no free programming editors that support as many languages as Subethaedit on OS X or even gedit or Kate or nedit on Linux.... though Subethaedit is my favorite because of its clean interface.

    the best free editor on Windows is crimson editor I think. I used it a lot on my HP laptop before I got my iBook.
     
  10. Aug 22, 2005 #9

    anyway, back on topic.

    you do not need a development tool to prototype it in pseudo-code. just use paper and pencil since you are simply using made up commands to describe how the code will work.
     
  11. Aug 24, 2005 #10

    jim mcnamara

    User Avatar
    Science Advisor
    Gold Member

    The "julian day" you seem to mention is just the number of days in the year - ie.,
    February 5, 2005 is the 36th day of 2005. In computerese it's called the year-day or day of the year.

    What you need is a list of the number of days in each month for a whole year -
    with February having either 28 or 29 days, to handle a leap year.

    Then, work down the list of months (taking into account which version of February to use) by:
    top:
    Compare number of "julian" days to length of the month.
    If the length of the month is greater than the days left, you have the month name
    and the number of days is the day of the month. Exit at this point.
    If the number of days is greater than the month, subtract the month, make the next month in the list the current month
    (remember the February problem? Is this a leap year, yes or no? Is the month February?).
    next, go to top

    Now try to change the English into pseudocode.

    If the Julian date really is a Julian date, and not a year-day, then you need to know which Julian date system is being used. Days since Jan 1, 1857, days since the current epoch, or days since Dec 31, 4713 BC? And then you have a far tougher problem. And it may include the 'short September 1752' problem if you live in the US.

    see:
    http://www.dome-igm.com/convers.htm
     
Know someone interested in this topic? Share this thread via Reddit, Google+, Twitter, or Facebook

Have something to add?



Similar Discussions: A C problem
  1. C code problem (Replies: 19)

  2. P/C problem (Replies: 3)

Loading...