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:


   *                   *
     *               *
       *           *
         *       *
           *   *
             *
In this lab, you need to decompose that image into three pieces, and write a function which prints out each piece. This will result in the following three functions:

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:

Exercises

  1. In your labs directory, write a program procedure-practice.c with these features:
    • Include stdio.h
    • Write stubs for the three separate basic tasks outlined above (e.g., small_v). Each of these functions should return int (a zero, as the function terminates), and use void to indicate there are no input parameters.
    • The main program 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 main function, write the comments first to outline the work to be done. Then add the function calls.

  2. 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.

  3. Update your main program 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!

  4. 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:

  1. Identified all authors who contributed to the program
  2. Included an Academic Honesty Statement at the top of the program file.
  3. Documented each function (except for main).
  4. Included comments within main to describe what you are doing.

Note: there is no autograder for this program.