[Sussex] Limited Time Available

Steve Dobson steve.dobson at krasnegar.demon.co.uk
Sun Mar 2 15:09:01 UTC 2003


Nik

On Sat, Mar 01, 2003 at 10:23:51AM +0000, Nik Butler wrote:
> write a small algorithm to calculate the date of the last Thursday in
> any month. This to then return the value in the form.
> 
> dd Month 

I've written a simple like C++ program - it's not quite to spec as it 
output in three formates "<Day-of-Week> <date> <Month> <year>",
"Tomorrow (<Day-of-Week> <date> <Month> <year>)" or
"Today (<Day-of-Week> <date> <Month> <year>)".

I changed the output for the following reasons:

  *) Having the day of the week is helpful.  Someone interested in coming
     can know - "Yes I'm free Thursday nights".

  *) By adding "Tomorrow" or "Today" shows that they need to act
     quickly.

I'm going to work on it so that with arguments it will allow the selection
of other days - this would make it useful for the other LUGs which don't 
meet on the last Thursday.

The source and make file is attached.

Steve
-------------- next part --------------
A non-text attachment was scrubbed...
Name: Day.cpp
Type: text/x-c++src
Size: 1148 bytes
Desc: not available
Url : http://mailman.lug.org.uk/pipermail/sussex/attachments/20030302/83d2303e/attachment.cpp 
-------------- next part --------------
A non-text attachment was scrubbed...
Name: Day.h
Type: text/x-chdr
Size: 968 bytes
Desc: not available
Url : http://mailman.lug.org.uk/pipermail/sussex/attachments/20030302/83d2303e/attachment.h 
-------------- next part --------------
A non-text attachment was scrubbed...
Name: moottime.cpp
Type: text/x-c++src
Size: 804 bytes
Desc: not available
Url : http://mailman.lug.org.uk/pipermail/sussex/attachments/20030302/83d2303e/attachment-0001.cpp 
-------------- next part --------------
SRC.cpp  = moottime.cpp Day.cpp
OBJS  += ${SRC.cpp:%.cpp=%.o}

CPPFLAGS := -g

all: ${OBJS}
	${LINK.cc} -o moottime ${OBJS}


More information about the Sussex mailing list