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