Chapter 3 Exercise Set 1: CPE PracticeΒΆ

  1. What is the output of the following program?

    #include <iostream>
    using namespace std;
    
    int main() {
        for (float f = -4.0; f < 500; f *= -2)
            cout << '*';
        cout << endl;
    
        return 0;
    }
    
  2. What is output by the following snippet?

    int a = 1, b = 2;
    float f = a / b;
    cout << f << endl;