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

Keyboard answer

cin · about 12 minutes

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

How it works.

cin читает то, что ввёл человек. Стрелки >> направлены к переменной.

int age;
cin >> age;

✦ When checking in the lesson, the input is not performed: the training example shows the finished value.

STEP 2

Try to understand.

When checking in the lesson, the input is not performed: the training example shows the finished value.

int age = 8;
cout << age << 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>
using namespace std;

int main() {
    int age = 8;
    cout << age << endl;
    return 0;
}
Open the editor for class work
HOMEWORK

Solve it yourself

Создай int age = 9 и выведи age. Когда запустишь программу сам, попробуй заменить присваивание на cin >> age.

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

Opening up your homework