Click here to Skip to main content
15,881,173 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
JokeRe: can anyone give code in vc++ Pin
CPallini14-Apr-09 5:08
mveCPallini14-Apr-09 5:08 
GeneralRe: can anyone give code in vc++ Pin
Hamid_RT14-Apr-09 8:42
Hamid_RT14-Apr-09 8:42 
GeneralRe: can anyone give code in vc++ Pin
CPallini14-Apr-09 9:12
mveCPallini14-Apr-09 9:12 
GeneralRe: can anyone give code in vc++ Pin
Hamid_RT14-Apr-09 9:40
Hamid_RT14-Apr-09 9:40 
GeneralRe: can anyone give code in vc++ Pin
CPallini14-Apr-09 10:44
mveCPallini14-Apr-09 10:44 
GeneralRe: can anyone give code in vc++ Pin
Hamid_RT14-Apr-09 20:23
Hamid_RT14-Apr-09 20:23 
GeneralRe: can anyone give code in vc++ Pin
_AnsHUMAN_ 14-Apr-09 1:14
_AnsHUMAN_ 14-Apr-09 1:14 
AnswerRe: can anyone give code in vc++ Pin
pallaka14-Apr-09 0:02
pallaka14-Apr-09 0:02 
It should be in maths blog.Anyway Use the logic given below.....i hope it will help u

The Basic Steps

The basic steps for a date in the years 2000-2099 are as follows:

Example date July 13th, 2004

1. Take the last 2 digits of the year and add a quarter onto itself. (04 + 1 = 5)
2. Get the corresponding code for the month. (January = 6, February = 2, March = 2, etc. See month codes for details). July = 5
3. Take the day. (=13)
4. Add the numbers together (5 + 5 + 13 = 23)
5. Take away 7 (or multiples of 7) until a number from 1-7 is left. (23 - 21 =2)
6. This number corresponds to the day of the week. (1 = Monday, 2 = Tuesday, etc.) In this case 2 = Tuesday

The basic steps | Other points | Month codes | Leap years | Gregorian calendar | Shortcuts | Examples | Other methods | Books | Links | Whose idea?
Other points to take into account

Apart from the basic steps, other elements have to be taken into account:

* When adding a quarter of the year onto itself, If the quarter of the year is not a whole number, simply ignore the decimals. Do not round up. Therefore 27/4 = 6.75 = 6, and 2/4 = 0.5 = 0.

* Leap years: subtract 1 from the total if the month is January or February.

* Negative numbers. During the calculation you get 0 or negative numbers, just add seven until you get a number from 1-7.

* Different "centuries" *.
o 1700s add 5
o 1800s add 3
o 1900s add 1
o 2100s subtract 2
o 2200s subtract 4

(* For this method we have to consider a '00' year as part of the new century)

The basic steps | Other points | Month codes | Leap years | Gregorian calendar | Shortcuts | Examples | Other methods | Books | Links | Whose idea?
The codes for the months

At first the hardest part is learning the codes for the months. They are as follows:
Jan Feb Mar Apr. May Jun Jul Ago Sept Oct Nov Dec
6 2 2 5 0 3 5 1 4 6 2 4

Try to use some memory system to remember the codes for the months. for example, February is the 2nd month, March 2 music, etc. Try to find associations that will remind you.

If need be, you can add 7 or multiples of 7 to any of these values to help you remember them. For example, August could be 1 or 8, and as it is the 8th month, it may be easier to remember with 8 than with 1. This may be useful if you can match it with a well-known date. You could remember that the code for December is 25 (4+21), or for someone's birthday. The negative aspect of this is that you'll be taking away the 7 (or multiples) towards the end of the calculations, and you'll be working with bigger numbers.
The basic steps | Other points | Month codes | Leap years | Gregorian calendar | Shortcuts | Examples | Other methods | Books | Links | Whose idea?
Leap Years

* Remember that leap years are not always every 4 years. There are exceptions. Years that end in 00 are not leap years unless it is a multiple of 400. Therefore 1700, 1800, 1900, and 2100 are not leap years, but 2000 is.

The basic steps | Other points | Month codes | Leap years | Gregorian calendar | Shortcuts | Examples | Other methods | Books | Links | Whose idea?
The Gregorian Calendar

* The calendar as we know it only came into effect (in England) in 1752, replacing the Julian calendar. Changes included cutting 11 or more days out of the calendar and changing the first day of the year from march 21st to January 1st, and so this calculation method should not be used for dates before this changeover.
* Unfortunately, not everyone agreed to the change at the same time. The change was in fact officially enacted in 1582, but only some catholic countries actually did change at this time. After this other countries took their time before accepting the change. Great Britain in 1752, Japan in 1873 and China (the last) in 1949. In several cases, such as Germany, only some regions changed at a time, and Sweden removed the days one by one over a long time.
* The overall result of this is that for centuries, each country had its own system, and dates did not fall on the same day. if you are looking at a date, you need to take into account if it was before the changeover in that country, and take into account the 10 (or more) days removed from the calendar, the the fact that the years used to start on a different day.

The basic steps | Other points | Month codes | Leap years | Gregorian calendar | Shortcuts | Examples | Other methods | Books | Links | Whose idea?
Shortcuts

There are several shortcuts that can be used to simplify and speed up the process so that you can calculate the result almost immediately.

* When working out the year, remember that as the calendar repeats itself every 28 years within each "century", we can subtract 28 or multiples of 28 (56 or 84) so it is easier to add a quarter on to the year if it is a smaller number. Therefore 1996 is the same as 1996-84 =1912. It is much easier to add a quarter of 12 onto itself, than a quarter of 96. In this way, the greatest number you will have to work with is 27.

* When the year is a multiple of 4, such as 16, it is very easy to add a quarter (16/4=4 16+4 =20.). Some people may have problems when the number is not a multiple of 4. (e.g. 27/4). Because we do not need the decimals in the result, the easiest and quickest way is to take the nearest multiple of 4 below the number, and calculate a quarter of that, adding it onto the year. (e.g. 1927: the nearest multiple of 4 below this is 24. 24/4=6. add 6 to 27 to get 33.) Many people may find this easier than working out the division and then eliminating the decimals (27/4=6.75. eliminate the decimals to get 6. add 6 to 27 to get 33)

* It is good practice to subtract 7 or multiples of 7 at this point rather than adding on the month and the day before doing it. The same is true for the day. This is because it is easier to recognize and subtract multiples of 7 from smaller numbers.

* Simply remembering the final year code for the current year and the coming year makes instant calculations possible, as calculating the year code is the time-consuming process. For the years 2000-2003, the numbers correspond to the last digit of the year. This is a very quick method.
GeneralRe: can anyone give code in vc++ Pin
Cedric Moonen14-Apr-09 0:08
Cedric Moonen14-Apr-09 0:08 
GeneralRe: can anyone give code in vc++ Pin
Chris Losinger14-Apr-09 1:54
professionalChris Losinger14-Apr-09 1:54 
GeneralRe: can anyone give code in vc++ Pin
toxcct14-Apr-09 4:15
toxcct14-Apr-09 4:15 
GeneralRe: can anyone give code in vc++ Pin
David Crow14-Apr-09 2:44
David Crow14-Apr-09 2:44 
Questionsearch vectors Pin
kaminem13-Apr-09 23:20
kaminem13-Apr-09 23:20 
QuestionRe: search vectors Pin
David Crow14-Apr-09 2:47
David Crow14-Apr-09 2:47 
AnswerRe: search vectors Pin
kaminem14-Apr-09 3:41
kaminem14-Apr-09 3:41 
QuestionRe: search vectors Pin
David Crow14-Apr-09 3:43
David Crow14-Apr-09 3:43 
AnswerRe: search vectors Pin
kaminem14-Apr-09 3:53
kaminem14-Apr-09 3:53 
AnswerRe: search vectors Pin
kaminem16-Apr-09 5:41
kaminem16-Apr-09 5:41 
QuestionHow to Kill the Worker Thread ? Pin
Suresh H13-Apr-09 23:06
Suresh H13-Apr-09 23:06 
AnswerRe: How to Kill the Worker Thread ? Pin
Rajesh R Subramanian13-Apr-09 23:14
professionalRajesh R Subramanian13-Apr-09 23:14 
GeneralRe: How to Kill the Worker Thread ? Pin
Suresh H14-Apr-09 0:26
Suresh H14-Apr-09 0:26 
GeneralRe: How to Kill the Worker Thread ? Pin
Rajesh R Subramanian14-Apr-09 0:48
professionalRajesh R Subramanian14-Apr-09 0:48 
AnswerMessage Closed Pin
13-Apr-09 23:26
ParagPatel13-Apr-09 23:26 
GeneralRe: How to Kill the Worker Thread ? [modified] PinPopular
Hamid_RT13-Apr-09 23:39
Hamid_RT13-Apr-09 23:39 
GeneralRe: How to Kill the Worker Thread ? Pin
Cedric Moonen13-Apr-09 23:41
Cedric Moonen13-Apr-09 23:41 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.