Remember to create a new directory in your repository for this lab.
$ cd CNET-cs152-spr-16 $ mkdir hw2 $ svn add hw2 $ cd hw2
Beginning in lab 2, lab time will be spent Duet Programming. Read this short introduction to Duet Programming. Create a new file in your hw2 directory named lab2questions.txt and add it to the repository. A quick way to do this is to use the unix command touch. This will create and empty file and give it a name. Then you can add it to the repository. This way, when you commit later, you don't need to remember to add it!
$ touch lab2questions.txt $ svn add lab2questions.txt $ vi lab2questions.txtNow copy and paste the following questions into the file. Fill in the answers as you go through the pre-lab.
During the warmup, you are going to implement several functions that exercise control, iteration, and recursion.
In order to spend your time efficiently in lab, I have provided
the skeleton files that compile, but without implementations filled in.
There are three files: warmup2_main.c,
warmup2.h, and
warmup2.c.
Read the below descriptions, then you are ready to go to lab.
Given a number, print the corresponding lower-case letter of the alphabet. The number can be anything from 0 to 25. 0 prints out 'a', 1 prints out 'b', 2 prints out 'c', etc. It also returns the character.
Given a character, print the corresponding upper-case letter of the alphabet using asterisks. The letter can be anything from 'I' to 'L'. The set of letters are here..
Draw a sideways trapezoid. The width is the number of asterisks in the middle row. The number of asterisks in a row always increases by one each row until it reaches the specified width. Then, at the bottom, it also decreases by one each row until there are none.
* ** *** *** *** *** *** *** ** *
Draw a trapezoid. The width is the number of asterisks in the bottom row. Each row has two fewer asterisks than the one below it.
void draw_trapezoid(unsigned int width, unsigned int height);
draw_trapezoid(5,2) results in:
*** *****