Discussion 10-6

Strings and chars

After ints and doubles, our next important variable types are string and char. We can use a string to store text, and a char to store just one character. We wrote stringsAndChars.cpp which demos most of the string functionality we'll need in 10A. Here's a quick list, with common mistakes in red.

Strings and chars

We wrote convertToUpperCase.cpp, which shows some basic string and character operations. The way C++ deals with adding or subtracting chars (treating them as numbers) is confusing at first, but it's often really useful!

Google searches

Here are some Google searches you could try if you're having trouble with today's material. I'm deliberately trying to choose search terms that you could have thought of yourself!

Extra stuff to try for fun (not required)

This is a modified version of the convertToUpperCase.cpp program from class.