ECE 1011 - Summer 2003

HOMEWORK #2

(Last Modified: 04 Nov 2010 )

In this program, you will get familiar with using a couple of the Borland console.h functions for character graphics.

The main idea is to take the program for HW#1 and modify it so that it draws the same basic display, although it will not be a moving display like HW#1.

Your display should have two parts:

  1. A "header area" at the top where you print out your name and the program information.

  2. The "display area" where you actually display the curves.

First, play around with the functions getch(), putch(), kbhit(), and gotoxy() from <conio.h>. There is a link to a page describing them on the course website main page.

Now, use these functions to draw one period of the same four functions from HW#1, namely a sine wave, a sawtooth wave, a square wave, and a triangle wave. These should be in the "display area".

Finally, modify your code so that the user has to hit a key between each waveform. In other words, print out the header information only. Then, after the user hits a key, print out the sine wave and stop. After the user hits a key again, print out the sawtooth wave. Continue in the fashion until all four waveforms are displayed.

You can use printf() to print out your header but you may only use putch() to display the waveforms.