AllExperts > Qbasic, Quickbasic 
Search      
Qbasic, Quickbasic
Volunteer
Answers to thousands of questions
 Home · More Qbasic, Quickbasic Questions · Answer Library  · Encyclopedia ·
More Qbasic, Quickbasic Answers
Question Library

Ask a question about Qbasic, Quickbasic
Volunteer
Experts of the Month
Expert Login

Awards

About Us
Tell friends
Link to Us
Disclaimer

 
 
 
 
About Alex Barry
Expertise
I have been a qbasic programmer since 2000, creating games, minor libraries and various small programs. I have experience using interrupts, graphics, file input/output, the mouse cursor, and using libraries. I have also learned FreeBASIC, c/c++, python, php and html.
I do not claim to be an absolute authority in any language, but I don't mind looking things up and learning with you.

Experience
Hobby programming since 2000

I no longer belong to any community programming groups, but do have knowledge of *basic dialects and C/C++

 
   

You are here:  Experts > Computing/Technology > Basic > Qbasic, Quickbasic > leap year program for qbasic

Qbasic, Quickbasic - leap year program for qbasic


Expert: Alex Barry - 3/31/2009

Question
I need to know how to write a leap year program on quickbasic but i cant figure it out will someone write the code so i can see how to write it?

Answer
Hi, Daniel,
To figure that out, check out this link:
http://support.microsoft.com/kb/214019

To move this into QBasic, it's easiest to make it into a function:

DECLARE FUNCTION IsLeapYear%( year AS INTEGER )

FUNCTION IsLeapYear%( year AS INTEGER )
 ' First, assume it is not a leap year
 IsLeapYear% = 0
 IF (year MOD 4) = 0 THEN
   IF (year MOD 100) = 0 THEN
     IF (year MOD 400) = 0 THEN
       IsLeapYear% = 1
     END IF
   END IF
 END IF
END FUNCTION

Hope that helps,
-Alex

Add to this Answer   Ask a Question


 
User Agreement | Privacy Policy | Kids' Privacy Policy | Help
Copyright  © 2008 About, Inc. AllExperts, AllExperts.com, and About.com are registered trademarks of About, Inc. All rights reserved.