in pascal, if i wanna classify something into different category and count how many items i have in each category, how would i do that?

Recommended Answers

All 3 Replies

Your question is much too vague for me to help you.

What is it you wish to classify?

for instance, if i wanna check all years from 2000 to 2050 and show each leap year and how many leap years there are, how would i show how many leap years there are?

OK, that helps.

This is a purely mathematical question. You'll need a function to tell you if a given year is a leap year or not. It so happens that the Delphi VCL has a function that does just that: uses SysUtils; function IsLeapYear( year: word ): boolean; Now think about how you can use that function to check each year for a leap year, and count how many leap years you find.

Hint: get out the construction paper and crayons and do it there first. This helps me all the time because by first solving the problem without the computer I have a better idea of how to tell the computer how to solve the problem.

Once you get some code together, post back here.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.