Technology Questions

Go Back   Technology Questions > Software Questions > General Questions

General Questions Talk about the latest software versions of your favorite applications: Browsers, Communications & messaging, Mac applications & utilities, Microsoft Office, PC applications & utilities, and Virus & security alerts.

Reply
 
LinkBack Thread Tools
  #1 (permalink)  
Old 06-18-2007, 04:27 AM
Registered User
 
Join Date: Mar 2006
Posts: 11
berni2k is on a distinguished road
C++ Program with Classes

Hi,

How could i code this fast in C++ by using classes:
I want to output the work days between two dates (start and end date input by user).

I thought through it but dont know how to code it.

My thoughts:
1) calculate (count up) the absolute days between the two dates (with using time.h and week modulo)
2) make a class with holidays
3) calculate the holidays with the Gauss easter algorithm (found it on wikipedia and some other site, see bottom of post)
4) substract the holidays from the abolute days
5) cout the absolute days and the count up of holidays and the final work days

Carl Friedrich Gauß (1777 - 1854):

a = Y mod 19
b = Y mod 4
c = Y mod 7
d = (19a + M) mod 30
e = (2b + 4c + 6d + N) mod 7

Y: year with 4 digits

M and N:
for 1583 - 1599 -> M=22, N=2
1600 - 1699 -> 22, 2
1700 - 1799 -> 23, 3
1800 - 1899 -> 23, 4
1900 - 1999 -> 24, 5
2000 - 2099 -> 24, 5
2100 - 2199 -> 24, 6
2200 - 2299 -> 25, 0
2300 - 2399 -> 26, 1
2400 - 2499 -> 25, 1

taking the above easter sunday should be: (22 + d + e).March or (d + e - 9).April
and there are 2 annomalies:
1) if the result of the above falls on the 26th of April -> easter sunday will be held on the 19th of April instead
2) If a > 10 and d = 28 and the result the 25. April, -> easter sunday be corrected to the 18. April.

but how to code this?
HELP

thx a lot
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote

 
Old 06-18-2007, 04:27 AM
Reply

Bookmarks

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Object Oriented F# - Creating Classes TPC General Questions 0 10-06-2008 02:41 AM
Mick Murphy - How Are Your Classes Going - Just FYI Mrs. Spanky deMonkey Windows Vista 5 02-12-2008 07:50 PM
Failed to initialize all WMI classes Arthur Kater Windows Vista 0 07-17-2007 12:50 AM
Are there Vista online classes? bls8195 Windows Vista 2 04-10-2007 10:45 PM
TelePresence in Classes in the Future? Robert Heiny Tablet PC - Education Articles 0 11-01-2006 06:40 PM


New To Technology Questions? Do You Need Help with Your Computer or Device? Do You Need Help with this site?

All times are GMT -8. The time now is 05:04 PM.


2003 - 2009 All Rights Reserved. Technology Questions

Search Engine Friendly URLs by vBSEO 3.3.0