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

Truth or falsehood

bool and comparison · about 12 minutes

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

How it works.

The comparison is given by true or false. This answer can be found in bool.

bool enough = 8 > 5;

✦ Signs == verify equality, and one = retains value.

STEP 2

Try to understand.

Signs == verify equality, and one = retains value.

bool enough = 8 > 5;
cout << enough << 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() {
    bool enough = 8 > 5;
    cout << enough << endl;
    return 0;
}
Open the editor for class work
HOMEWORK

Solve it yourself

Save in bool equal check 4 = = 6. Output equal: get 0.

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

Opening up your homework