1) Please fix indent of code. That is very hard to read.
2) Why are you calling monthcheck even if the month is entered wrong?
Code:
if (monthNo <=0) or (monthNo >12) then
begin
monthcheck;
3) Public variables and procedures are bad coding style. You should learn to use functions.
For example monthcheck could aswell be written as:
Code:
function getMaxDays(month, year: integer): integer;
// Monthcheck as a name doesn't tell much. You can use the names for understandability
begin
case month of {This section gives the}
4,6,9,11: result := 30; {months their correct lengths}
2: if year mod 4=0 then result := 29
else result := 28;
else result := 31;
end;
end;
4) You had monthMax instead of monthNo in the case inside monthcheck procedure.
edit: 5) What are monthmax, monthnumber variables anyway? They aren't used or initialized anywhere.
Bookmarks