Question: Setting up the Programming Environment Read the individual problem directions carefully before starting. Do your own work. To set up the environment, from the UNIX
Setting up the Programming Environment Read the individual problem directions carefully before starting. Do your own work. To set up the environment, from the UNIX terminal: 1. Type mkdir hw1 This will create a new directory (folder) named hw1. Work out of this directory. In order to do that, 2. Type cd hw1. This changes the current working directory to the directory hw1. 3. Copy the les average.cpp sin.cpp averageNoError.exe sinNoError.exe from the directory /class/cse1222/5059/hw1 by typing cp /class/cse1222/5059/hw1/* . This command copies all les in /class/cse1222/5059/hw1 into your current direc- tory. Be sure to include the asterisk, \*", and the period, \.". Type ls to be sure you copied the les correctly. All four les should be listed in your current directory. 4. Type emacs average.cpp &, and begin working. Note that if you want to work on this le at a later time, you only have to do steps 2 and 4. 2 Work by Yourself All lab and programming assignments are to be done by yourself. You may discuss labs or assignments with other students in the class but DO NOT LOOK AT ANYONE'S CODE OTHER THAN YOUR OWN. Needless to say, you should not share or copy anyone else's code. 3 Correcting the programs Programs average.cpp and sin.cpp have both syntax and logical errors. The assignment is to correct these errors so that the programs perform as specied. Do not delete any comments from the code. (You may have to modify the code so that the comments are properly recognized as comments.) Change the code as little as possible. Don't ewrite" the code. Just x the errors. Once you have corrected all the errors, your code should produce the exact same output as the programs averageNoError.exe and sinNoError.exe. 1. Fix all the syntax errors in average.cpp so that it compiles without errors. 2. Fix all the logical errors in average.cpp so that it computes the average of 3, 5, 8, the average of 4, 6, 13, the averge of 7, 9, 13, 14, and outputs the averages on three separate lines. 3. Replace ????? in the line \Modified by" in le average.cpp with your name. 4. Replace ????? in the line \Modified on" in le average.cpp with the current date. 5. Fix all the syntax errors in sin.cpp so that it compiles without errors. 6. Fix all the logical errors in sin.cpp so that it reads in a variable x and computes sin(x ), sin(x ) + sin(x )*sin(x ), sqrt(1 + sin(x )) and outputs the solutions on separate lines. The function sqrt(x) computes the square root of x . 7. Replace ????? in the line \Modified by" in le sin.cpp with your name. 8. Replace ????? in the line \Modified on" in le sin.cpp with the current date.
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
