Last modified: Saturday, December 11, 2010
string_list2
) with the
same public interface as string_list
,
BUT using LINKED NODES (a simple linked list)
instead of a dynamically-allocated array:
string
values string_list
from Week 15, Lecture 1!) new
); implementing a
string_list
class
using a dynamically-allocated array; includes an example of
static (as used in a class)
display_boa
- a function whose parameter
is a pointer to a boa
swap
- an example of pass-by-reference
get_double_at
- a silly little function that
expects a pointer to a double and returns the double
it is pointing to (as a simple example of a function with a
pointer parameter)
show_ptr
- a silly little function that
returns the address
of its local variable (as a simple early pointer example)
main
function calling
spiciness
and using a sentinel-controlled
loop main
function calling
spiciness
and using a sentinel-controlled
loop main
function calling
spiciness
and using a loop taking
a "question" approach cin
(interactive/console input),
example of a function that changes its parameter array
main
function written using the
main
function template, that uses cin
to read in a name then used as the argument to function
greeting
(thus providing an interactive
interface to the greeting
function): main
function written using the
main
function template, that plays
around a bit with using cin
to read values
into variables of several different types: get_nums
- example of a void
function that uses cin
and changes its
corresponding argument array: main
function,
compiling and linking C++ functions to create a C++ program
main
function template
main_template.txt
main
function written using the
main
function template above, that calls
function sum_array
from last Friday's lab: greeting
- example of a void
function, one that doesn't return anything, that only has
a side-effect: greeting
is called in
greeting_ck_expect.cpp's main
function)
sum_array
example, introducing the
for
-loop
sum_array
- a function with
an array parameter (and another parameter with the array's size):
sum_array
with debugging
cout
statements:
cout
-supplemented sum_array.cpp cout
for screen output,
started discussing
functions with array parameters
cheer
- a function with a count-controlled
while
loop and cout
side-effects: while
statement/while
loop
boa
class that now includes modifier methods
and a zero-argument constructor: playing
:
playing.cpp,
playing.h, and
playing_ck_expect.cpp if
statement, and a little about the C++
switch
statement
ring_area
(which uses
circ_area
):
ring_area.cpp,
ring_area.h, and
ring_area_ck_expect.cpp abs_value
(which uses
an if
-statement):
abs_value.cpp,
abs_value.h, and
abs_value_ck_expect.cpp spiciness
(which also uses an
if
-statement):
spiciness.cpp,
spiciness.h, and
spiciness_ck_expect.cpp describe_grade
bonus after-class
example, using switch
:
describe_grade.cpp,
describe_grade.h, and
describe_grade_ck_expect.cpp circ_area
from 8:00 am lab:
circ_area.h, and
circ_area.cpp, and the testing function
circ_area_ck_expect.cpp is_safe
from 8:00 am lab:
is_safe.h, and
is_safe.cpp, and the testing function
is_safe_ck_expect.cpp name_length
from 8:00 am lab:
name_length.h, and
name_length.cpp, and the testing function
name_length_ck_expect.cpp circ_area
from 10:00 am lab:
circ_area.h, and
circ_area.cpp, and the testing function
circ_area_ck_expect.cpp is_safe
from 10:00 am lab:
is_safe.h, and
is_safe.cpp, and the testing function
is_safe_ck_expect.cpp name_length
from 10:00 am lab:
name_length.h, and
name_length.cpp, and the testing function
name_length_ck_expect.cpp random
function
cond
expressions; the modulo
function;
boolean functions
rect-area
function from following the design recipe) rect-area
function from following the design recipe)