Dec 052017
 
Pascal source and doc's on using queue's for beginners. freeware.
File PASCAL_Q.ZIP from The Programmer’s Corner in
Category Recently Uploaded Files
Pascal source and doc’s on using queue’s for beginners. freeware.
File Name File Size Zip Size Zip Type
QUEUE.EXE 7680 5581 deflated
QUEUE.PAS 3855 1562 deflated
QUEUE.TXT 3810 1556 deflated

Download File PASCAL_Q.ZIP Here

Contents of the QUEUE.TXT file


QUEUE! (C)1995 by Matt Hum
aka. Matt's Queue program
All Rights Reserved

SEE ALSO:
--------
OPSTACK! - an introduction to stacks

INTRODUCTION:
------------
This program is distributed to the Public Domain for use by people learning
PASCAL as a language. This is an example on usage of stacks. You may do
anything you wish to this piece of code, as long as I am not held responsible
for any damages that can occur from this piece of software or any modifications
made to the source by the user, or any virii in the software, as this software
is distributed VIRUS-FREE.

WHAT IS A QUEUE?
----------------
This builds upon stacks. It is either recommended to get the file OPSTACK.ZIP,
which explains stacks, or have previous knowledge of stacks, and/or data
structures. The best way to describe a queue is a line of people in a store.
People get in the back of the line and leave from the front of the line,
supposing no one cuts in line. In effect, for a queue, you can push onto the
bottom of a queue, and pop off the top.
example:
# list- 6 4 5 8 5 7 8 queue
-----
push the first 4 numbers onto the queue 6
6 4
6 4 5
6 4 5 8
pop off a number - popped number=6 4 5 8
push the rest 4 5 8 5
4 5 8 5 7
4 5 8 5 7 8
pop the numbers - popped number=4 5 8 5 7 8
popped number=5 8 5 7 8
popped number=8 5 7 8
popped number=5 7 8
popped number=7 8
popped number=8

THIS PROGRAM:
------------
This program takes random numbers to pop onto the queue. it also pops off the
numbers from the queue. it uses an array of 10 bytes to store the queue. it
has two pointers to keep track of where the queue begins and where it ends. The
queue starts with both pointers at the beginning of the queue. When a number is
added, it increases the end pointer. When a pointer is extended to the end of
the array, it first checks so that the two pointers are never the same byte
(only when pushing to the queue), and then wraps the pointer. when you remove
data from the queue, it reads the data at the beginning pointer, and then
increases this pointer. It also wraps at the end of the queue, but this time,
the beginning pointer and end pointer are allowed to point to the same byte.
This is so you are able to pop the last number off the queue. You see, isn't
that simple now?

Here are some guidelines to follow:
1. don't get too complicated-complicated programs can often confuse the
programmer that wrote it, especially, if the programmer is inexperienced
2. if it doesn't work the first time, try, try again. this can be a little
frustrating, but i'll pay off, when you finally get it.
3. if it still doesn't work, try rewriting it. this can become monotonous,
but often this happens a lot in programming.
4. Enjoy programming. Have fun doing it.
Umm, that's all for queues now, you can try to build this into an object. OOP
rulez! Look for other programs I release for beginners in PASCAL. Often they
will be written by either me, or in cooperation with Wavelength Software Inc.

For any questions, comments, compliments (I hope)
you can reach me at the BioInsanity BBS
@(301)942-0504 between the hrs of 5pm-7am
or e-mail me on the internet at [email protected]


 December 5, 2017  Add comments

Leave a Reply