C++ · ОСНОВЫ · LESSON 03

Text box

string · about 12 minutes

Learning with progressRead the summary for free. To save the work, log in to the account.
STEP 1

How it works.

string хранит слова. Для этого нужен заголовок <string>.

string pet = "кот";

✦ You can save the text and then show it by name.

STEP 2

Try to understand.

You can save the text and then show it by name.

string color = "синий";
cout << color << endl;

✦ Compare this to the first one. Then do the cool job yourself.

IN-CLASS PRACTICE

Type the code yourself

Manually type the program from the sample. So you'll remember commands and brackets.

#include <iostream>
#include <string>
using namespace std;

int main() {
    string color = "синий";
    cout << color << endl;
    return 0;
}
Open the editor for class work
HOMEWORK

Solve it yourself

Create string city with the word «Киев» and output city.

The answer is hidden. Use similar examples from the lesson notes.

Opening up your homework