Lesson 2 of 24
Variables, auto and string
8 min 20 XP
C++ adds bool (true/false) and string (text), so no more C char-array headaches. With auto the compiler works out the type for you.
Example: edit me and press Run
Output Loading C++ (first time takes a few seconds)
Press Run to see the result here.A bool prints as 1/0 by default; boolalpha prints true/false. For decimal places use fixed << setprecision(2) from <iomanip>.