Name: ____________________________________________________ Alpha: _____________ Section: ___________

Describe help received: _____________________________________________________________________

See the bottom for how to submit your work.

Due: Before 0800 on next class day

  1. (10 pts) Read lecture notes from today. Honestly declare how you read the notes.
    1. (10 pts) I read the notes carefully. I have a good understanding of the topics therein.
    2. (10 pts) I read the notes carefully, but I don't really understand the following points well:
      
      
      
      
    3. (0 pts) I didn't read the notes carefully.
  2. [90pts] Write a program with source file named hw.cpp that works like this (with the user input colored in red):

    ~/$ ./hw
    Values for a and b? 111, 1
    What do you want? add 10 to a
    a = 121 and b = 1
    
    ~/$ ./hw
    Values for a and b? 1.1, -2.2
    What do you want? square b
    a = 1.1 and b = 4.84
    

    That is, the program receives two numbers for a and b (separated by a comma), receives a command, and then executes it.

    The following commands are possible:

    In the above, num can be any real number.

    Note: assume that the input is always formatted correctly, so you don't need to check whether the input is valid.

Turn in (Due: 0800 on the next class day)