A C problem

  • Thread starter kant
  • Start date
  • #1
kant
388
0
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:

Answers and Replies

  • #2
ComputerGeek
383
0
kant said:
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

What do you have to show us as far as the work you have done so far?
 
  • #3
kant
388
0
ComputerGeek said:
What do you have to show us as far as the work you have done so far?


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?).
 
  • #4
Grotesque Puppet
41
0
  • #5
kant
388
0
That s a great link , thank you.
 
  • #6
ComputerGeek
383
0
kant said:
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?).

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.
 
  • #7
Grotesque Puppet
41
0
Its better than switching platforms entirely
 
  • #8
ComputerGeek
383
0
Grotesque Puppet said:
Its better than switching platforms entirely

:-)

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.
 
  • #9
ComputerGeek
383
0
kant said:
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


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.
 
  • #10
jim mcnamara
Mentor
4,674
3,595
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
 
Last edited by a moderator:

Suggested for: A C problem

  • Last Post
Replies
6
Views
426
  • Last Post
Replies
9
Views
509
Replies
1
Views
2K
  • Last Post
Replies
2
Views
590
Replies
9
Views
891
  • Last Post
Replies
11
Views
617
Replies
9
Views
634
Replies
6
Views
769
Replies
8
Views
508
Top