CS 111 - Week 11 Lecture 1 - 2016-11-01

*   some odds and ends:

==========
*   escaping special characters

    *   consider " and ', for example!

        "moo"   <-- char* literal
	'm'     <-- char literal

    *   what if you WANT a single quote as a char literal?
        or a double quote within a char* literal?

    *   you need a way to ESCAPE its special meaning
        JUST when needed;

    *   in C++, you can often do this by
        preceding the special character with a \

        you can't do:
        "The cow says, "Mooooo".

        but you CAN do:
	"The cow says, \"Mooooo\"."
	
        you can't do:
	'''

        but you CAN do:
	'\''

        you can't do:
	"here is a backslash: \"

        but you CAN do:
	"here is a backslash: \\"

    *   (you can try these in expr_play to see... 8-) )

==========
*   quick .h file note:
    *   one reason (of several) for a .h file
        is so another function can more conveniently
	use that function;

    *   a main function in C++ can't call another
        main function (there's ONE main function
	per C++ program...)

        *   so, our main functions will typically
	    not have a .h file

	    (although they CAN if you'd like to put
	    named constants there)

==========
*   building C++ non-main functions and main tester functions
    "from scratch", not using funct_play 
    (starting from the templates in the References section of the
    public course web site --
    *   say you are developing a non-main function; you might:
        *   FIRST: copy the non-main-function-template into a 
	    desired_funct_name.cpp file,

	    THEN follow the design recipe as you adapt that
	    template for YOUR function;

        *   SECOND: copy the .h file template into a desired_funct_name.h
	    header file, 

	    and adapt it for your function, (possibly including
	    named constant definitions, also);

        *   THIRD: copy the main-template into a testing main file
	    desired_funct_name_test.cpp,

	    THEN follow the design recipe as you adapt that template
                for YOUR testing main,
	    appropriately adding in your tests from the function's
	        Examples section;
            (and print statements describing what side-effects
	        should happen, for functions WITH side-effects);

*   TRYING this out some more:
    *   first: using PuTTY/ssh, nano, and g++, on nrs-labs;
        *   function rect_area (in rect_area.cpp and rect_area.h)
            and a testing main function for rect_area in
	    rect_area_test.cpp

    *   then: using NotePad++/TextWrangler on one's own computer, 
        WinSCP/FileZilla/sftp to transfer the source code files
            (.cpp and .h files) to nrs-labs, 
        and PuTTY/ssh, nano, and g++ on nrs-labs;
        *   ALSO trying our first void function -- a function that
	    does not return ANYTHING, it JUST has side-effects!

            *   give such functions a return type of void
            *   do not try to return a value from these!
            *   CALL them like a statement -- do NOT put them in
	        a cout or *within* another expression,
		they don't have a value, they don't return anything!

        *   function say_sound (in say_sound.cpp and say_sound.h)
            and a testing main function for say_sound in
	    say_sound_test.cpp

        (we'll finish this example on Tuesday -- it is ready
            to WinSCP/FileZilla/sftp to nrs-labs...)