From the course: C++ Essential Training
Unlock the full course today
Join today to access over 24,000 courses taught by industry experts.
I/O Stream - C++ Tutorial
From the course: C++ Essential Training
I/O Stream
- [Instructor] The iostream library is fairly rich, but most of what's there is backend support, and there's really just a few classes that you'll normally use. This is iostream-formatting.cpp from Chapter 9 of the exercise files. Iostreams come in two basic flavors: input streams and output streams. Let's take a look at how this works, we're going to look at cout and cin, and you'll notice that I haven't really aliased any of this. We're using so many different things in the iostream library, it just seemed better to just go ahead and spell them all out. So I'm going to comment out everything from about here, so that we can look at these bits in some sort of order. So here we have cout "Hello, World!" with a new line, and we've seen this before. And we declare a string called istr, I S T R, and we cout a prompt with no new line, so it'll just be on one line there and then we cin from istr and you notice my comment…
Practice while you learn with exercise files
Download the files the instructor uses to teach the course. Follow along and learn by watching, listening and practicing.