a. (20 pts) I read it very carefully. b. (15 pts) I read it. c. (10 pts) I just skimmed it. d. (0 pts) I didn't read it.
Do one or the other of the versions of Problem 1 described below. You do not need to do both! The 90% solution is simpler to do (though more tedious and less interesting) and only worth at most 63 points. The 100% is a bit tougher (though less tedious and more interesting) and is worth 100 points. Most important to me is that I get a working program from you.
Remember: plan out the basic steps of your program before you start with the actual code. Also, look at the example problems at the end of the class notes. Seeing how they work will help you design your own solution.
|A 90% Solution||A 100% Solution|
Write a program that reads in two complex numbers and prints out their
product. A typical session with the program might look like this (user
input is in red):
Enter the real part of u : 3 Enter the complex part of u: 4 Enter the real part of w : -0.5 Enter the complex part of w: .25 (3 + i*4) * (-0.5 + i*0.25) = -2.5 + i*-1.25
Write a program that reads in a complex number from the user and prints
out its cube - i.e. it reads in a complex number w and prints out w^3. A
typical session with the program might look like this (user input is in
Enter the real part of w : -1.2 Enter the complex part of w: 1.3 (-1.2 + i*1.3)^3 = 4.356 + i*3.419Note: I do not want you to derive a single mathematical expression for the cube of a complex number, which is a very ugly expression, and use that in your code. Cubing means multiplying twice. Use that!
A note about using the Internet to complete this homework: You may be tempted to google how to do complex numbers with c++ and come across the complex library. You should not be using this library because the point of the assignment is to complete it using the skills you currently have based on the lessons so far; which means variable assignments and arithmetic expressions and nothing else. The purpose of this homework is for you exercise those skills and not the skill of googling for solutions that have not been covered in class.
Note: Shift+PrintScreen does the screencapture within the VM. This means that the resulting .png file (which you name yourself) should be dragged outof the VM desktop and onto the Windows desktop to print.
codprintfollowed by the names of the .cpp files you want to print. For example, if I have files foo.cpp and bar.cpp I would give the command
codeprint foo.cpp bar.cpp
out.pdfwhich you can then print out in whatever way works best for you. I recommend you click on the folder icon along the right-hand side of your VM's desktop, navigate to the right directory, and drag out.pdf of the VM desktop and onto your Windows desktop.