Simulation programs are either time-driven or event-driven. In both cases, the state of the simulation model is updated at discrete points in time. The emphasis, however, will be on event-driven simulation. The general structure of any discrete-event simulation program will be discussed. The simulator contains a Random Number Generator (RNG), which is the main source of randomness in the simulation program. Executing the simulation model results in new events which are passed to the simulator. Several programming issues arise when writing event-driven simulation programs. Mishandling them may cause the simulation program to produce wrong statistical results. There are two approaches to writing simulation programs: time-driven and event-driven. This chapter proposes a template for discrete-event simulation programs. The single-server queueing system can be modeled in two ways: discrete-time and continuous-time. In discrete-time queues, time evolves in discrete steps of the same size.