Name: ____________________________________________________ Alpha: _____________________

Describe help received: _________________________________________________________________

  1. [50pts] Complete the program p1.cpp by writing the prototype and definition for the "sumSqures(n)" function which computes the sum of the first n squared numbers, i.e. it computes 1*1 + 2*2 + ... + n*n.
    Example Runs of the Program: (user input in red!)
    ~/$ ./p1
    Enter x: 10
    The sum of the first 3 squared numbers is 14, which is the first greater than 10
    ~/$ ./p1 
    Enter x: 100
    The sum of the first 7 squared numbers is 140, which is the first greater than 100
    ~/$ ./p1 
    Enter x: 1000
    The sum of the first 14 squared numbers is 1015, which is the first greater than 1000
    

  2. [50pts] Complete the program p2.cpp by writing the prototype and definition for the "getTime()" function.

    Example Runs of the Program: (user input in red!)

    ~/$ ./p2
    Enter first time: 3:12:42
    Enter second time: 4:06:19
    Ellapsed time is 3217 seconds
    
Turn In: A screen capture of a terminal window showing both programs running on the sample inputs from above, and a codeprint printout of the source code for the three programs. Note that you can print both as a single pdf file by listing all the files in a single code-print command:
codeprint p1.cpp p2.cpp
... which should also save you some paper.