CSC 162 - Review

Curricula
syllabus |
announcements |
assignments | discussion

Archives
student work |
review notes

Resources
research materials |
tutorials | web courses |

Contacts
home to: course | instructor |
department | La Salle home

E-Mail: redmond@lasalle.edu  


08/29/01 - Here is code from today's class - basic differences from C to C++, particularly I/O: program .

trace of a different program demonstrating an C++ iostream and iomanip formatting (from spring 2000).

08/31/01 - Function examples:

Default parameter program demonstrated in class on 8/31

Reference parameter program demonstrated in class on 9/05

Overloaded function (with Reference parameter) program demonstrated in class on 9/05

09/07/01 - Class examples:

(code - the header file card.h)
(code - the implementation file card.cpp)
(code - the main function file cardsmain.cpp)

09/10/01 - Class examples: (code - the header file deck.h)
(code - the implementation file deck.cpp)

09/12/01 - class examples

Also - Revised Account class header file. and Revised Account class implementation (code) file. These didn't follow the convention that file names should match class names because I wanted to keep the original account files out on the www. The revisions were to add operators such as == that are needed for using generic functions with vectors, lists etc.

(code - a very simple main file which is a client of the account class - file called account-client.cpp)

First Midterm from Spring 2000.

answers for first midterm from Spring 2000.

10/03/01 - String example: Splitting text into words shown in class on 10/03->

10/08/01 - String example: Added to file with splitting into words - find and replace functions. shown in class on 10/05

Code for Assignment 5. WordMatrix header file. and WordMatrix.cpp implementation file. Build your main using these.

10/12/01 - Vector example: Some basic use of a vector of strings. shown in class on 10/10

Use of a vector of Accounts - can expand if necessary - plus shows use of some generic functions - sort, reverse, and how to loop through a vector using an iterator . shown in class on 10/12 .

Code for Assignment 6. Student header file. and Student.cpp implementation file. Build your main using these.

Code for function templates function templates in header file. and main function testing a function template using Accounts. Requires project to have account-new.h and account-new.cpp.

Second Midterm from Spring 2000.

answers for second midterm from Spring 2000.

For Assignment 7 Song class header file. and Song class implementation (code) file. and One sample data file with songs. and mygetline code - plus notes on starting out with files.

main function testing some list capabilities using a list of accounts. Done in class on 10/29/01 and 11/02/01.

main function testing some list capabilities using a list of integers. Done in class on 11/05/01.

Code for Assignment 8. Student header file. and Student.cpp implementation file. Build your main using these.

.

11/12/01 - Internals example:

Budd's code didn't compile under Microsoft Visual Studio v6.0. The problem appears to be circular references making it impossible to put definitions before their use. To make this as simple as possible, I have created a class that serves to hold a linked list of Accounts. This is no where near as general as the library, but avoids a lot of complexity (for example it doesn't use templates at all. The AcctListList and AcctListNode files are to be used for Assignment 9. Files: (the header file AcctListList.h)
(the implementation file AcctListList.cpp)
(the header file AcctListNode.h)
(the implementation file AcctListNode.cpp)
(the client (main) file AcctListtestclient.cpp)

This requires the use of accounts - Revised Account class header file. and Revised Account class implementation (code) file. These didn't follow the convention that file names should match class names

The following were written in class and largely replicate the above - but some code is only equivalent, not exact duplicate. (the header file AcctListListinclass.h)
(the implementation file AcctListListinclass.cpp)
(the header file AcctListNodeinclass.h)
(the implementation file AcctListNodeinclass.cpp)
(the client (main) file AcctListclientinclass.cpp)
.

Bank account class hierarchy with savings, checking, interest checking - discussed in class on 11/16 and 11/19 (the main file allacct-client.cpp)
(the main client done in class)
AND (the header file checking.h)
(code - the implementation file checking.cpp)
AND (the header file intcheck.h)
(code - the implementation file intcheck.cpp)
AND (the header file savings.h)
(code - the implementation file savings.cpp)
This also requires the Account class which is the base class - it is available above.

11/26/01 - queue example:

Budd's bank simulation example - cleaned up and with comments and some I/O added. (the one file serves all file bank.cpp (contains teller and customer headers and implementations plus main - not what I would have done - but made it easy to down load - probably why they did it that way)

The class example for stacks was a depth first search with backtracking for the eight-puzzle. The interesting stack operations are in magicsquaremain.cpp
which controls the whole process. This is built on a magic square class that is defined in magicsquare.h.
The implementation in magicsquare.cpp
gets kinda hairy. Also - don't expect this to run quickly - it took 6 hours to run for me.

Code for use with Assignment 11 - (code - the header file improved-card.h)
(code - the implementation file improved-card.cpp)
(code - the header file improved-deck.h)
(code - the implementation file improved-deck.cpp)
NOTE - either change names or change includes

.

. FROM PREVIOUS SEMESTER

.

.

. .

05/05/00 - Sample Test Questions - questions of a similar style to that on the final exam - only for last part of test - test is cumulative but you've seen the style of earlier questions. sample .

04/25/00 - template function example:

Range template functions (the header file contains template functions)
(the client file that tests range.h using cards - requires card and deck classes

04/14/00 - queue example:

Budd's bank simulation example - cleaned up and with comments added. (the one file serves all file bank.cpp (contains teller and customer headers and implementations plus main - not what I would have done - but made it easy to down load - probably why they did it that way)

04/14/00 - stack example:

This example does not really illustrate the things stacks are REALLY good at, but it illustrates stack operations with the very familiar Account class. Using this relys on having Account.h and Account.cpp. (the client file Accountstacktestclient.cpp)

04/05/00 - Internals example:

Budd's code didn't compile under Microsoft Visual Studio v6.0. The problem appears to be circular references making it impossible to put definitions before their use. To make this as simple as possible, I have created a class that serves to hold a linked list of Accounts. This is no where near as general as the library, but avoids a lot of complexity (for example it doesn't use templates at all. Files: (the header file AccountListList.h)
(the header file AccountListList.cpp)
(the header file AccountListLink.h)
(the header file AccountListLink.cpp)
(the header file AccountListtestclient.cpp)

04/05/00 - Inheritance example:

Bank account class hierarchy with savings, checking, interest checking - discussed in class on 3/31. (the main file allacct-client.cpp)
AND (the header file checking.h)
(code - the implementation file checking.cpp)
AND (the header file intcheck.h)
(code - the implementation file intcheck.cpp)
AND (the header file savings.h)
(code - the implementation file savings.cpp)
This also requires the Account class which is the base class - it is available below.

03/31/00 - Sample Test Questions - questions of a similar style to that on the second midterm test. sample . topics in for midterm 2. .

03/27/00 - List examples:

3/27/00 - code from class on 3/24/00 and 3/27 (code - the main file listinclass.cpp)

additional larger client demoing additional list capabilities.

Also - for Assignment 7 Revised Song class header file. and Revised Song class implementation (code) file.

Examples of vector capabilities shown in class on 3/6 3/21/00 - code available for assignment 6

(code - the header file card.h)
(code - the implementation file card.cpp)
(code - the header file deck.h)
(code - the implementation file deck.cpp)

3/21/00 - code from class on 3/20/00 (code - the header file account-vect-iter-client.cpp)

03/06/00 - Vector examples:

Examples of vector capabilities using song class that I created shown in class on 3/8. additional larger client demoing additional vector capabilities.

Also - Song class header file. and Song class implementation (code) file.

Examples of vector capabilities shown in class on 3/6

02/23/00 - Sample Test Questions - questions of a similar style to that on the first midterm test. sample .

02/23/00 - My War assignment Solution my code - other solutions exist.

02/23/00 - String examples: Examples of string capabilities shown in class on 2/21-2/23 Similar Examples of string capabilities to that shown in class on 2/21-2/23

02/18/00 - String example: Splitting text into words shown in class on 2/18->

02/14/00 - Class code for assignment: (code - the header file account.h)
(code - the implementation file account.cpp)
01/31/00 - Class examples: War program shown in class on 1/28->

Interactive War program We'll probably skip in class.

Look here for my enhanced examples of the Rational class from C++ Program Design by Cohoon and Davidson. These materials include redmo5-rational.h - a header file containing class definition and prototypes, redmo5-rational.cpp an implementation file containing code for the functions, and redmo5.cpp a "client" file - a program that uses the rational class. To use these - you must create a project and include all three files in the project. The program loops 5 times - each time asking for two rational numbers (i.e. fractions (e.g. 1/2 )) - and calculates various things using class capabilities - + - * / etc. I think this is a useful second example of object-oriented programming.

program demonstrated in class on 1/19

Here is a trace of a program demonstrating an insertion sort (for chapter on arrays).

Here is a brief explanation of recursion, along with a trace of a factorial function being used to calculate 5!. The program has extra output to help in demonstrating how recursive functions build up a sequence of calls, and then "unwind" to produce a result.

Here is a trace of a program demonstrating some C++ formatting.