© Ray Lischner 2020
R. LischnerExploring C++20https://doi.org/10.1007/978-1-4842-5961-0_4

4. Strings

Ray Lischner1 
(1)
Ellicott City, MD, USA
 
In earlier Explorations, you used quoted character strings as part of each output operation. In this Exploration, you will begin to learn how to make your output a little fancier by doing more with strings. Start by reading Listing 4-1.
import <iostream>;
int main()
{
   std::cout << "Shape\tSides\n" << "-----\t-----\n";
   std::cout << "Square\t" << 4 << '\n' <<
                "Circle\t?\n";
}
Listing 4-1.

Different Styles of String Output

Predict the output from the program in Listing 4-1. You may already know what \t means. If so, this prediction is easy to make. If you don’t know, take a guess.
  • _____________________________________________________________ ...

Get Exploring C++20: The Programmer's Introduction to C++ now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.