Introduction

A variable of char type can store a single character.
Character literals must be declared using single quotes.
ASCII is a standard for encoding characters to numbers.
An escape sequence is a two-character sequence that represent a special character. Example: '\n'

An initialized variable whose value cannot change is called a
constant variable.

An overflow occurs when the value being assigned to a variable is greater than the maximum value the variable can store.

When debugging compiler error messages, start from the top of the error list, and recompile after fixing one problem.

Variables of type bool store true and false values.

Branch statements are surrounded by Braces {}.
Branch conditions are surrounded by Parentheses ().

Putting branches inside other branches is called nesting.

The 6 comparison operators are: >, <=, <, <=, ==, and !=.
The results of these operators are of type bool.

The 3 logical operators are &&, ||, and !.
&& evaluates to true when both of its operands are true, and false otherwise.
|| evaluates to true when either of its operands are true, and false otherwise.
! evaluates to true when its operand is false.

Code tracing

What does each main function ouptut? Assume all required libraries are included. Refer to the last section for extra help.

// 1
int main() {
    char c1 = 'x';
    char c2 = c1 - 'a' + 'A';

    cout << c1 << ' ' << c2 << endl;

    c1 += 1;
    c2 += 1;

    cout << c1 << ' ' << c2 << endl;

    return 0;
}
// 2
int main() {
    int i = 2;
    int j = 5;
    int k = -3;

    if (i > k) {
        i *= k;
    }

    if (j < i) {
        j *= i;
    } else {
        j /= 5;
    }

    if (j * 3 > -k) {
        k = -k / 3;
    } else if (j * 3 < -k) {
        j = j * 3;
        k = -k;
    }

    if (i > 0) {
        i = k;
    } else if (k > 0) {
        k = i;
    } else if (j > 0) {
        j = i;
    }

    cout << "i = " << i << endl;
    cout << "j = " << j << endl;
    cout << "k = " << k << endl;

    return 0;
}
// 3
int main() {
    int i = 2;
    int j = 5;
    int k = -3;
    bool b1 = true;

    if (i > k && !b1) {
        i *= k;
    }

    if (j < i && b1) {
        j *= i;
    } else {
        j /= 5;
    }

    if (!(j * 3 > -k)) {
        k = -k / 3;
    } else if (j * 3 <= -k) {
        j = j * 3;
        k = -k;
    }

    if (!(i > 0) || (j - i > 0)) {
        i = k;
    } else if (((k > 0) && !(-k < 0)) || b1) {
        k = i;
    } else if (!(j > 0) || (i - j > 0)) {
        j = i;
    }

    cout << "i = " << i << endl;
    cout << "j = " << j << endl;
    cout << "k = " << k << endl;

    return 0;
}
// 4
int main() {
    int i = 2;
    int j = 5;
    int k = -3;
    bool b1 = true;

    if (i > k && b1) {
        if (-i < -k || !b1) {
            k += 5;
        }
        i *= k;
    }

    if (j >= i) {
        if (j == i) {
            j -= 6;
        }
        j /= i;
    } else {
        if (j > k && j < i) {
            j -= 1;
        }
        j *= 5;
    }

    if (j * 3 > k) {
        if (!(j * 3 <= -k)) {
            b1 = !b1;
        }
        k = -k * 3;
    } else if (j * 3 <= -k || b1) {
        j = j * 3;
        k = -k;
    }

    if (!(i > 0) || (j - i > 0)) {
        i = k;
        if (i == k) {
            k += 6;
        }
    } else if (((k > 0) && !(-k < 0)) || b1) {
        k = i;
        if (b1) {
            i += 6;   
        }
    } else if (!(j > 0) || (i - j > 0)) {
        j = i;
        if (b1) {
            j += 6;
        } else if (b1 || !b1) {
            i += 3;
        }
    }

    cout << "i = " << i << endl;
    cout << "j = " << j << endl;
    cout << "k = " << k << endl;

    return 0;
}
//5
int main(){
    int j = 1;
    int k = 2;
    bool b = false;

    if(j || k){
        k = 0;
    }

    if(k){
        j = 0;
    }

    if((j == k) || (b = true)){
        k -= 2;
    }
    else if(!b){
        j += 3;
        k -= 4;
    }
    else{
        j *= k;
    }


    cout << "j = " << j << endl;
    cout << "k = " << k << endl;
    return 0;
}
//careful...

Extra Help