Advertisement
Guest User

Untitled

a guest
Jan 23rd, 2020
172
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.92 KB | None | 0 0
  1. Problem#2
  2. Copy the source code below exactly into the IDE of your choice (Repl.it, CodeBlocks
  3. etc.). Attempt to compile it. Examine the compiler errors and fix the syntax errors
  4. one at a time starting with the first error on top. PASS leaders may need to help with
  5. scanf() and printf() modifiers.
  6. Broken Program Source Code:
  7. /**************************************************
  8. * Top comment code is not required for this example.
  9. * You would put your
  10. * N number here too.
  11. **************************************************
  12. #include <stdioh>
  13. int main(int)
  14. {
  15. int age_In = 0:
  16. print("Enter in your age please.\n");
  17. scanf("%d", age_in);
  18. printf("You told me your age is: %f\n");
  19. return;
  20. }
  21.  
  22. Problem #3
  23.  
  24. Create an algorithm of approximately 4 – 6 steps that solves the following problem
  25. for a program.
  26. The story of the Hesperus is written about by Henry W. Longfellow a famous poet.
  27. The poem is about a shipwreck that happened off the coast of Massachusetts in
  28. 1839. The reef that the wreck happened upon is located in 7 fathoms of water. We
  29. want to know how many feet and how many inches this wreck lies in.
  30. What steps must your program perform in order to solve this problem? These steps
  31. should be limited to how a computer would solve them. I.e.: Save a value X into a
  32. variable.
  33. Algorithm for Hesperus
  34. 1.)
  35. 2.)
  36. 3.)
  37. 4.)
  38.  
  39. Problem #4
  40. Given the algorithm from the previous step, compose a solution in the form of
  41. source code using an iterative approach. Do not move past any step where there is a
  42. failure.
  43. 1.) Create the basic program structure in one main function. Save it and compile
  44. it before adding more code.
  45. 2.) Add code to accomplish step 1. Compile and test the added code.
  46. 3.) Add code to accomplish step 2. Compile and test the added code.
  47. 4.) Add code to accomplish step 3. Compile and test the added code.
  48. 5.) ….keep adding the next step until the source code and the program work to
  49. complete the task/problem.
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement