Question: yp e mkdir hw1 This will create a new directory (folder) named hw1 . Work out of this directory. In order to do that, 2.
yp e mkdir hw1 This will create a new directory (folder) named hw1 . Work out of this directory. In order to do that, 2. Typ e 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/8782/hw1 by typing cp /class/cse1222/8782/hw1/* . This command copies all les in /class/cse1222/8782/hw1 into your current direc- tory. Be sure to include the asterisk, \ * ", and the p erio d, \ . ". Typ e ls to b e sure you copied the les correctly. All four les should b e listed in your current directory. 4. Typ e emacs average.cpp & , and b egin 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 b e 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 co de. 1 3 Correcting the programs Programs average.cpp and sin.cpp have b oth syntax and logical errors. The assignment is to correct these errors so that the programs p erform as sp eci ed. Do not delete any comments from the co de. (You may have to mo dify the co de so that the comments are prop erly recognized as comments.) Change the co de as little as p ossible. Don't ewrite" the co de. Just x the errors. Once you have corrected all the errors, your co de should pro duce 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 ro ot 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
