Latest Update: 03/03/2000
03/03/2000 -- Added a few remarks near the end.
02/28/2000 -- Added note about tutoring schedule
Week 03 Notes for CS 2500 -- Spring 2000
(this is draft material)
* Take roll
* The tutoring schedule is now available
in the General_Info section
* Take a quick look a this week's section of the
schedule.
* We discuss the first programming assignment.
+ discuss main loop
- abstract version of main loop
- more concrete version of main loop
+ discuss design considerations for second
level functions.
* We discuss what has to be done in a level-two
program.
+ examine model of a level-two program in the
set of course documents.
* We look at an example program that is similar,
but simpler -- it turns an array up-side-down.
(This example code is now available in the
assignment directory)
* We need to start discussing recursion soon.
* We may need to save some time at end of class
one day to show people how to get (Internet
Explorer?) Netscape on the Suns.
* We can talk about arrays, records, arrays of
records, records containing arrays, etc.
* At end of week, maybe we can re-write the
version of the main loop in "BridgeHandsHelp"
so it has function calls with parameters.
Then we can talk about what each function has
to do.
* Students should use stubs at level one and
test before going on to level two. This helps
to get bugs out with less effort by isolating
faults. It's best to write a program one
function at a time. Stub out any
sub-functions and run the program to see if
there are any problems with the new function.
* Students should note that at stub for "Mark
the rest of the hand as present" has to do a
little more than some stubs would have to do:
the stub has to read past the 12 cards and
move down past the end-of-line. Otherwise the
rest of the main loop will get "out of sync"
with the input, and tests of the main loop will
go awry.
* Take a look at the file in the assignment
directory that shows how to translate from
integer card codes to character card codes for
the output. Notice how "\t" is used to do
tabs.
------------------------- cut here -------------------------
Notes about the LEVEL ONE version of the bridge
program:
char rankChar, suitChar ;
/* test by attempting to get the first part of the first card */
while (cin >> rankChar)
/* the input command returns a value of true
or false -- the test we need. This loop is a big
part of the solution we need. It takes care of starting right
and stopping right. */
{
/* get the rest of the first card */
cin >> suitChar;
Zero out the array ;
Mark the first card as present
/* the next step involves reading the info about the next 12 cards */
/* THE STUB FOR THIS STATMENT HAS TO GET PAST
THE DATA ON THE CURRENT LINE. The stubs
for the other functions don't have to do
much.*/
Mark the rest of the hand as present
PrettyPrint the hand
}
------------------------- cut here -------------------------
Commands for Compilation
g++ sourcename.cpp
(* a.out is target *)
g++ -o targetname sourcename.cpp
(* target is named "targetname". *)