CSCI 1300 Computer Science 1: Programming
Spring 2004
Karl Winklmann
|
|
Programming examples |
|
| Program | Description |
|
| |
| HelloWorld | A very short first program to try out the environment |
| ValidatingInput | A loop that does not quit until the user provides good input |
| Loops | Loops, some nested, with graphics output (as done in class) |
| KeyboardEvents | Handling keyboard events without stopping the action |
| RandomNumbers | A toy random number generator |
| A function | Using a function to validate input |
| Functions + mouse |
Parameter passing by value and by reference Functions for getting information from the mouse |
| Mouse, buffering, buttons | from class on Tuesday, February 3 |
| Arrays | Arrays, as done in class on Thursday, February 5 |
| ShuffleAndSort | Shuffle an array of numbers, then sort them |
| KaTS | Sample project: “Karl's Traffic Simulation (KaTS)” |
| OneMouseTwoIcons | Clicking and dragging when more than one object is present |
| OneMouseManyIcons | Clicking and dragging when a whole array of objects are present |
| Button | Clicking a button, and then reacting to the presence of the mouse |
| BallClass | Example of a class and objects from Tuesday, Feb 24 |
| ArrayOfBalls | Example of an array of objects from Tuesday, Feb 24 |
| SliderBar | as done in class on Thursday, Feb 26 |
| SliderBars | now with two bars operating, with text data, and with separate compilation of the SliderBar class |
| FloodFill | Using Minesweeper as an example, showing a recursive “flood fill” function |
| FloodFillWithTrace | ... now with output that traces the sequence and depth of calls |
| Clock | ... another example of a (useful) class, this one with default parameters in the constructor and with user-defined operators |
| Set | ... yet another example of a (useful) class, this one implementing a set of integers using a partially filled array |
| List | Lists, showing how pointers can be used |
| DArray | A dynamically growing array |
| TextfileIO | How to read from and write to text files on the disk |
| StackTemplate | Template example (parameterizing your classes to work for any type of data) |
| BoardGame | Using templates from the Standard Template Library (STL). The templates used in this example are queue and stack in the Board::search function. |
| ExceptionHandling | Exception handling, here to get good input without crashing. (This example is slightly modified compared to the one discussed in class.) |
| CommandLine | Command line arguments, i.e., how to start up your program by commands like main -f testfile.txt -t "My stuff" |
| InheritanceDraggable | Making an icon (ball) draggable by inheriting a generic Draggable class |
| InheritanceStack | Adding to an STL template class by inheriting it |
| © 2004 Karl Winklmann | 5:53 PM, Thursday, April 29, 2004 |