Chapter 3 Exercises

  1. What is the data type of following?
    1.  4567
    2. -4567
    3. 1234567
    4.  98.76
    5. -98.76
    6. 500.
    7. .8
    8. 10E5
    9. 6.02E23
    10. 1234.567E89
    11. 9E-300
  2. Evaluate the expression: 7 * 10 - 5 % 3 * 4 + 9
  3. What is the value of the following expressions:
  4. int age;
    1. age = 8
    2. -age
    3. 5 + 8
    4. 5 / 8
    5. 5 / 8.0
    6. float( 7/3 )
    7. float( 7 ) / 3
    8. cout << "Hello, world!"
    9. cout << name
    10. cin >> score
  5. Given the following starter code below:
    #include <iostream> // for cout, endl
    #include <string> 
    
    using namespace std;
    
    int main( ){
    
        string profName = "Dr. C";
        string studAName = "StudentA";
        int profLevel = 99;
        int studALevel = 123;
        float profPoints = 42.0123456789;
        float studAPoints = 567.890123456;
    
        cout << "123456789012345678901234567890" << endl;
    
    
        
        return 0;
    }
    
    add code to display the values to exactly match the output below:
    123456789012345678901234567890
          Name     Level    Points
         Dr. C        99     42.01
      StudentA       123    567.89