Program Development
Introduction
This lab provides preliminary practice for creating a structured program framework utliizing simple functions.
Overview
For this lab, we will create some images out of asterisks. Consider the following image that looks like a giant V:
* *
* *
* *
* *
* *
*
small_v-
This function (procedure) will print the lower portion of the original image.
* * * * * left_side-
This function (procedure) should print the first three asterisks in the image.
* * * right_side- This function (procedure) should print the last three asterisks in the image.
* * *
Note that the idea is that the spacing is maintained between the three images.
Note: These three functions together will not allow you to create the giant V above. This is intentional. See problem 4.
Although the tasks below are reasonably elementary, be sure to follow the approaches described in today's reading, including:
- placing a high-level outline within comments,
- writing stubs for procedures at an early stage of program development,
- writing code details after the high-level comments are completed,
- adding details for one procedure at a time - not all at once.
Exercises
-
In your
labsdirectory, write a programprocedure-practice.cwith these features:-
Include
stdio.h -
Write stubs for the three separate
basic tasks outlined above (e.g.,
small_v). Each of these functions should returnint(a zero, as the function terminates), and usevoidto indicate there are no input parameters. -
The
mainprogram should begin to outline the following tasks that we will perform: print a check mark, print a reverse check mark, and print a downward arrow style image
In writing the task procedures, be sure to write comments before filling in the details.
In writing the
mainfunction, write the comments first to outline the work to be done. Then add the function calls. -
Include
-
Add details to the task procedures
in
procedure-practice.c, one procedure at a time—practicing the problem-solving approach of incremental and iterative program development. -
Update your
mainprogram to call combinations of these procedures to produce the following images: a check mark, a reverse check-mark, and a downward arrow style image (three of the small v's on top of each other). Of course, the overall outline of the work should be included within comments before the procedure calls are inserted! - Note that the functions you have created already will not allow you to draw a big V, like in the very original image. (If you're not convinced - try it!) Create another function that you can combine with one of your existing functions to create the big V. Add the big V to your main function as well.
Lab Report 1 Submission
All you need to do for this lab submission is to submit your procedure-practice.c file into Gradescope. Before submitting, review the Guidelines for submitting work. Make sure you have:
- Identified all authors who contributed to the program
- Included an Academic Honesty Statement at the top of the program file.
- Documented each function (except for main).
- Included comments within main to describe what you are doing.
Note: there is no autograder for this program.