I have a program I am trying to write. It is very basic but I'm not sure how to implement this specific function. Basically this is what I WANT my code to look like;
Date Day Availability
1 Monday Free
2 Tuesday Free
3 Wednesday Free
4 Thursday Free
5 Friday Free
6 Saturday Free
7 Sunday Free
...
and so on, up to 31 with the days repeating themselves in order again.
However this is what is currently happening
Date Day Availability
1 Monday Free
2 Monday Free
3 Monday Free
4 Monday Free
5 Monday Free
...
All the way up to 7 which then it gives me a Runtime Error.
This is the related coding;
TYPE
DAYS = (Monday, Tuesday, Wednesday, Thursday, Friday, Saturday, Sunday);
VAR
Day : ARRAY[1..7] OF DAYS;
{Display all entries}
PROCEDURE ShowList;
BEGIN
WRITELN('Date', 'Day':10, 'Availability':15);
FOR i := 1 to 31 DO
WRITELN (i:4, Day[i]:20, Bookings[i]:30)
END;
I've looked up for where I am going wrong but I've not found any help. Is there someone out there who could give my code a look over and hint me at where I am going wrong?