|
| | |||||||
| 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. |
| | LinkBack | Thread Tools |
| |||
| 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 |
| Bookmarks |
| Thread Tools | |
| |
| | ||||
| 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? |