The purpose of this reading and exercise set is give you more experience with branching in C++, including how to deal with floating point comparisons, and to introduce a few helpful functions for working with characters and strings.
Basic learning objectives
You are responsible for learning and demonstrating proficiency in the following objectives prior to the next class meeting:
- test if a character is alphabetic, a digit, or whitespace
- perform string operations such as adding new characters to a string, replacing portions of a string, concatenating strings, finding matches in a string, and extracting portions of a string
- recognize a conditional expression (often called "he ternary operator")
- explain why floating point numbers cannot be compared the same as integers
- predict what parts of a Boolean expression will be calculated based on short-circuiting
Advanced learning objectives
You should demonstrate mastery of the following objectives by the end of the next class meting through the in-class activities:
- use character and string operations in a program
- use and be able to explain a conditional expression within a program
- write accurate Boolean expressions to compare floating point numbers in a program
- write Boolean expressions to leverage short-circuiting to avoid unnecessary computations
Read Ch. 3 of the zyBook (sections 3.14–3.20). You may work with others on the exercises. If you have questions, please talk with a classmate or post your question to Piazza under the "gi 8" tag.
Complete the following. There is nothing to submit via Canvas; zyBook shows me what you've completed and when.
- carry out at least 80% of the "Participation Activities" (the orange ones) in the reading
- you can see how many of the participation activities you've done for a section or chapter using the "Reporting" tab on the main CSC160 zyBook page
- ask me or a classmate for help if you can't find it
- attempt the following "Challenge Activities"; spend ~20 minutes on each (it's okay if you don't get the solution)
- 3.14.1: String with digit
- 3.15.2: Name song
- 3.16.2: Conditional assignment
- 3.17.1: Floating-point comparison: Print Equal or Not equal
If you have a question while you are doing this, please post to the class Piazza board with the "gi 8" tag.