CMPSC 201 - Ch. 3 Worksheet #2 Name -

1. List the five most common arithmetic operators.

 

2. Write a valid line of code which uses a compound operator.

 

3. Identify the output of this program:

#include <iostream>
using namespace std;

int main( )
{
    int a = 0;
    int b = 0;
    int c = 0;

    a++;
    b--;
    c = b - 1;

    cout << a << endl << b << endl
           << c << endl;

    return 0;
}

4. What is the value of this expression:      5 + 2 * 3 % (10 / 2)

 

 

5. What is the final value of round?


double initial = 5.9;
round = int (initial);