YCP Logo Lab 18: Draw a cone using functions

Getting started

If you have a solution open in Visual Studio, close it (File->Close Solution).

Download CS200_Lab18.zip. Import it into Visual Studio (File->Import...).

Add your code to the source file called Cone.c.

Your Task

Write a program to draw a cone. Example run (user input in bold):

Height of cone? 6
     *
    ***
   *****
  *******
 *********
*********** 

Use two functions in your program:

  1. print_spaces: draw the leading spaces on each line
  2. print_stars: draw the row of * characters on each line

Both of these functions have a void return type, because they do not compute a value. Instead, they are used for a side-effect: printing output using printf.

Hints

In your main function, use a loop to print each row of the figure. Each row consists of a number of spaces and a number of stars. Within the loop body, call each of the two functions you have implemented to print the appropriate number of each character.

Submit

When you are done, choose Tools->Submit to submit your completed lab to the server. You will need to enter your Marmoset username and password.

If the Tools->Submit option does not work, create a zip file containing the files in your project, and upload it to the submission server as lab18. The server URL is

https://camel.ycp.edu:8443/