How To Think Like a Computer Scientist C++ Edition¶
Assignments¶
Table of Contents¶
- 1. The way of the program
- 2. Variables and types
- 3. Functions
- 3.1. Floating-point
- 3.2. Converting from
double
toint
- 3.3. Math Functions
- 3.4. Composition
- 3.5. Adding New Functions
- 3.6. Definitions and Uses
- 3.7. Programs with Multiple Functions
- 3.8. Parameters and Arguments
- 3.9. Parameters and Variables are Local
- 3.10. Functions with Multiple Parameters
- 3.11. Functions with Results
- 3.12. Glossary
- 3.13. Multiple Choice Exercises
- 3.14. Mixed-Up Code Exercises
- 3.15. Activecode Exercises
- 4. Conditionals and recursion
- 4.1. The Modulus Operator
- 4.2. Conditional Execution
- 4.3. Alternative Execution
- 4.4. Chained Conditionals
- 4.5. Nested Conditionals
- 4.6. The Return Statement
- 4.7. Recursion
- 4.8. Infinite Recursion
- 4.9. Stack Diagrams for Recursive Functions
- 4.10. Glossary
- 4.11. Multiple Choice Exercises
- 4.12. Mixed-Up Code Exercises
- 4.13. Activecode Exercises
- 5. Fruitful functions
- 5.1. Return Values
- 5.2. Program Development
- 5.3. Composition
- 5.4. Overloading
- 5.5. Boolean Values
- 5.6. Boolean Variables
- 5.7. Logical operators
- 5.8. Bool Functions
- 5.9. Returning from main
- 5.10. More recursion
- 5.11. Leap of faith
- 5.12. One more example
- 5.13. Glossary
- 5.14. Multiple Choice Exercises
- 5.15. Mixed-Up Code Exercises
- 5.16. Coding Practice
- 6. Iteration
- 6.1. Multiple assignment
- 6.2. Iteration
- 6.3. The while statement
- 6.4. Tables
- 6.5. Two-dimensional tables
- 6.6. Encapsulation and generalization
- 6.7. Functions
- 6.8. More encapsulation
- 6.9. Local variables
- 6.10. More generalization
- 6.11. Glossary
- 6.12. Multiple Choice Exercises
- 6.13. Mixed-Up Code Exercises
- 6.14. Coding Practice
- 7. Strings and things
- 7.1. Containers for strings
- 7.2.
string
variables - 7.3. Extracting characters from a string
- 7.4. Length
- 7.5. Traversal
- 7.6. A run-time error
- 7.7. The
find
function - 7.8. Our own version of
find
- 7.9. Looping and counting
- 7.10. Increment and decrement operators
- 7.11. String concatenation
- 7.12.
string
s are mutable - 7.13.
string
s are comparable - 7.14. Character classification
- 7.15. Other
string
functions - 7.16. Glossary
- 7.17. Multiple Choice Exercises
- 7.18. Mixed-Up Code Exercises
- 7.19. Coding Practice
- 8. Structures
- 8.1. Compound values
- 8.2.
Point
objects - 8.3. Accessing instance variables
- 8.4. Operations on structures
- 8.5. Structures as parameters
- 8.6. Call by value
- 8.7. Call by reference
- 8.8. Rectangles
- 8.9. Structures as return types
- 8.10. Passing other types by reference
- 8.11. Getting user input
- 8.12. Glossary
- 8.13. Multiple Choice Exercises
- 8.14. Mixed-Up Code Exercises
- 8.15. Coding Practice
- 9. More structures
- 9.1. Time
- 9.2.
printTime
- 9.3. Functions for objects
- 9.4. Pure functions
- 9.5.
const
parameters - 9.6. Modifiers
- 9.7. Fill-in functions
- 9.8. Which is best?
- 9.9. Incremental development versus planning
- 9.10. Generalization
- 9.11. Algorithms
- 9.12. Glossary
- 9.13. Multiple Choice Exercises
- 9.14. Mixed-Up Code Exercises
- 9.15. Coding Practice
- 10. Vectors
- 10.1. Vectors
- 10.2. Accessing elements
- 10.3. Copying vectors
- 10.4.
for
loops - 10.5. Vector size
- 10.6. Vector functions
- 10.7. Random numbers
- 10.8. Statistics
- 10.9. Vector of random numbers
- 10.10. Counting
- 10.11. Checking the other values
- 10.12. A histogram
- 10.13. A single-pass solution
- 10.14. Random seeds
- 10.15. Glossary
- 10.16. Multiple Choice Exercises
- 10.17. Mixed-Up Code Exercises
- 10.18. Activecode Exercises
- 11. Member functions
- 11.1. Objects and functions
- 11.2.
print
- 11.3. Implicit variable access
- 11.4. Another example
- 11.5. Yet another example
- 11.6. A more complicated example
- 11.7. Constructors
- 11.8. Initialize or construct?
- 11.9. One last example
- 11.10. Header files
- 11.11. Glossary
- 11.12. Multiple Choice Exercises
- 11.13. Mixed-Up Code Exercises
- 11.14. Coding Practice
- 12. Vectors of Objects
- 12.1. Composition
- 12.2.
Card
objects - 12.3. The
printCard
function - 12.4. The
equals
function - 12.5. The
isGreater
function - 12.6. Vectors of cards
- 12.7. The
printDeck
function - 12.8. Searching
- 12.9. Bisection search
- 12.10. Decks and subdecks
- 12.11. Glossary
- 12.12. Multiple Choice Exercises
- 12.13. Mixed-Up Code Exercises
- 12.14. Coding Practice
- 13. Objects of Vectors
- 13.1. Enumerated types
- 13.2.
switch
statement - 13.3. Decks
- 13.4. Another constructor
- 13.5.
Deck
member functions - 13.6. Shuffling
- 13.7. Sorting
- 13.8. Subdecks
- 13.9. Shuffling and dealing
- 13.10. Mergesort
- 13.11. Glossary
- 13.12. Multiple Choice Exercises
- 13.13. Mixed-Up Code Exercises
- 13.14. Coding Practice
- 14. Classes and invariants
- 14.1. Private data and classes
- 14.2. What is a class?
- 14.3. Complex numbers
- 14.4. Accessor functions
- 14.5. Output
- 14.6. A function on
Complex
numbers - 14.7. Another function on
Complex
numbers - 14.8. Invariants
- 14.9. Preconditions
- 14.10. Private functions
- 14.11. Glossary
- 14.12. Multiple Choice Exercises
- 14.13. Mixed-Up Code Exercises
- 14.14. Coding Practice
- 15. File Input/Output and
matrix
es- 15.1. File Input/Output and
matrix
es - 15.2. Streams
- 15.3. File input
- 15.4. File output
- 15.5. Parsing input
- 15.6. Parsing numbers
- 15.7. The
Set
data structure - 15.8.
matrix
- 15.9. A distance matrix
- 15.10. A proper distance matrix
- 15.11. Glossary
- 15.12. Multiple Choice Exercises
- 15.13. Mixed-Up Code Exercises
- 15.14. Coding Practice
- 15.1. File Input/Output and
Acknowledgements¶
You have attempted of activities on this page