Week 5: Strings and File IO
Learning objectives:
Upon finishing this learning module, you should be able to:- Write programs that manipulate strings
- Read and write text based files
- Format stream output
Deadlines This Week:
- Monday 11:59PM - Assignment 4
- Wed 11:59PM - Strings Basics CPPLab
- Fri 11:59PM - Strings Loops CPPLab
- Saturday 11:59 Quiz 2
Quiz:
Open Thursday-Sat in Elearn, TIME LIMITED (60 minutes), and NOT collaborative.Covers weeks 3 & 4. Make sure you block out an hour of uninterrupted time before you start the quiz - you can not pause the timer once you start. All the advice from the first quiz still holds true - go back to week 3 to refresh yourself.
Classroom Schedule:
- Monday
-
- Strings Continued
- CPPLabs: String basics
- Read Ch 15.15
- CPPLabs: String loops
- Tuesday
-
- File IO and Streams
- Read Ch 4.10 and 13.1-13.4 (14.11 is a simpler version of 13.1-4 you can start with if you like)
- Wed
-
- String & Stream wrap-up
- Ch 10.2.11-10.2.12
- / Midterm Review
- Fri
-
- CppLab Work Time/ Quiz Review
Online Activity Outline:
Quiz 2 opens Thursday - it focuses on the material from weeks 3 & 4 (Ch 4.1-4.7 and Ch5), but concepts from the first weeks are likely to be needed (variables, conditionals, etc...). Use the book author's website to do some practice quiz questions as you work on the new material.
Strings
- Make sure you have done the strings material from the end of last week. Then watch this video for some tips and tricks and read Ch 15.15:
- You should at least be aware of why it isn't 100% correct to say that .find() returns -1 when it can't find something in a string. This video explains what is really going on - don't worry about memorizing every detail, focus on identifying what is safe to do and what is not.:
- Do the CPPLab Strings.
-
This video shows you how to use a loop to work your way through a string:
- Do the CPPLab String Loops.
IOFormating
- Read Ch 4.10 on IO formatting. This video explains the basics:
FileIO
- Read Ch 13.1-13.4 on Reading Writing Files.
This videos introduce file writing and reading:
Streams and File Writing
File Reading
- You don't need them for the assignment, but I highly recommend you read 10.2.11 and 10.2.12 - talks about how to use strings as a stream (like a file you can read and write).
- Take the quiz.
- Do the assignment.
- Midterm is next week! Check the Files link below for a sample midterm
Extra Info:
Learncpp.com
This online tutorial covers some of the same ground as the Liang readings:
LearnCpp.com 17 (way more detail on strings) and 13
LearnCpp.com 17 (way more detail on strings) and 13
Classroom slides/examples:
Directory of files from the weekRight click files and save to your computer