Name: ____________________________________________________ Alpha: _____________________

Describe help received: _________________________________________________________________

  1. [10 pts] We would like you to self-test how much you retained from the lecture. Write the correct solution to the Mandatory Practice Problems. Debug your code until it runs correctly. Circle below how you wrote your code.
    1. (10 pts) I was able to write the code without referring to anything.
    2. (10 pts) I had to look at the notes, but still I was able to write the code without looking at the solution.
    3. (10 pts) I had to look at solutions to finish to code.
    4. (0 pts) I didn't do this.
    If you had to look at the solution, briefly describe what you missed but understand now.
    
    
    
    
  2. [90pts] You are to write a program that reads in two 3D vectors and prints out the inner product of them.
    
    // ADD code necessary.
    // Do NOT delete any code.
    
    struct Point3
    {
      double x, y, z;
    };
    
    
    int main()
    {
      Point3 a, b;
    
      cin >> a >> b;
    
      cout << "Inner product of " << a << " and " << b
           << " is " << a*b << endl;
    
      return 0;
    }
    
    Sample run:
    $/ .hw
    (1.1, 2.2, 3.3)
    (3, 4, 5)
    Inner product of (1.1, 2.2, 3.3) and (3, 4, 5) is 28.6
    
    Please add code overloading the necessary operators so that the program may work correctly.

Turn in