473,387 Members | 1,364 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,387 software developers and data experts.

leap year

I want leap year programme in c++. can u help me?
Oct 23 '07 #1
6 2839
sanctus
84
I want leap year programme in c++. can u help me?

What have you done so far?
Oct 23 '07 #2
Banfa
9,065 Expert Mod 8TB
Only if you try first please read our Posting Guidelines.
Oct 23 '07 #3
weaknessforcats
9,208 Expert Mod 8TB
D you understand how to calculate a leap year?
Oct 23 '07 #4
JosAH
11,448 Expert 8TB
D you understand how to calculate a leap year?
Yep: calulate the Julian day number using Zeller's congruence on the dates 1/1/x
and 1/1/(x+1) subtract the first from the second and see what the outcome is: if it is
366 year x is a leap year.

kind regards,

Jos ;-)
Oct 23 '07 #5
weaknessforcats
9,208 Expert Mod 8TB
Yep: calulate the Julian day number using Zeller's congruence on the dates 1/1/x
and 1/1/(x+1) subtract the first from the second and see what the outcome is: if it is
366 year x is a leap year.
Whatever happened to determining a leap year as divisible by 4 but not by 400 ??
Oct 23 '07 #6
Banfa
9,065 Expert Mod 8TB
Whatever happened to determining a leap year as divisible by 4 but not by 400 ??
Nothing because that is wrong it is

divisible by 4 but not by 100 except if it is divisible by 400 hence 2000 was a leap year.


The formula Jos mentions I image is just his warped sense of humour :D and anyway it appears to be a formula for week day so the difference he suggest should be in the range -7 <= result <= 7.
Oct 23 '07 #7

Sign in to post your reply or Sign up for a free account.

Similar topics

22
by: deepak.rathore | last post by:
can someone give the regular expr. to validate leap yr like 02/29/2000,02/29/00 Thanks
2
by: owz | last post by:
Ok, I am making a program (java class file) 2 work out if a date entered is valid or invalid for the day, month year, and for leap years.. dd/mm/yyyy . I seem 2 have gotten it 2 validate the year...
8
by: rn216_ccc | last post by:
Hi there all, I found a web site,. http://www.onlineconversion.com/leapyear.htm, where it can give a list of leap years by within the given range by the user, or the user may enter a year and the...
7
by: karafire2003 | last post by:
Hey there...i was wondering if someone can help me with my program. I'm doing the leap year program thing. i thought i had it all figured out, but it ALWAYS says that it's not a leap year. here's my...
8
by: SONIQ | last post by:
You can determine whether a year is a leap year by testing if it is divisible by 4. However, years that are also divisible by 100 are not leap years, unless they are also divisible by 400, in which...
12
by: Brigitte Behrmann | last post by:
Can anyone assist with my code. I just cannot get this to work: I have to write a script that allows the user to enter a year & then determine whether it is a leap year or not. The request is for a...
37
by: mazwolfe | last post by:
I'm new here, so excuse me if my style is incorrect. Can anyone come up with a better method for this calculation? Code: int is_leap(int year) { switch (year % 19) { case 0: case 3: case 6:...
5
by: jimix | last post by:
here's what i have. using microsoft studio #define _CRT_SECURE_NO_DEPRECATE #include <stdio.h> int main( void ) { int year, b, c, e; b = 4; c = 100;
4
by: jrw133 | last post by:
Hello. So im a little bit stuck on one of my homework questions. heres the question: Write a C Shell Script that performs the following functions. Asks the user to input a year. The script...
4
by: hallsers | last post by:
Here is the problem i am having: - When a user logs in, on page load it will take the dob of all users in a stored friends list and compare them against the following conditions - To display any...
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.