|
CS256 - Fundamentals of Structured Programming
| Displaying exercises/e9/files/c3.c
#include "c.h"
/**
* In a loop do:
* 1) Use the provided R() (in util.c) function to pick:
* - A random x coordinate
* - A random y coordinate
* - A random width between 1-20
* - A random height between 1-10
* - A random color (0-7)
*
* 2) Then draw a box of that width and height and color with the upper left
* corner at the randomly picked x,y position.
* 3) Use the 'usleep' function (man 3 usleep) to wait for about 1/20 of a
* second. There are 1,000,000 microseconds in a second.
* 4) Attempt to read a character with getch() and if it is a 'q' or 'Q',
* stop the loop and exit the program.
*/
int main(void)
{
// Keep this code:
init_curses();
// Makes getch() return immediately, even if no key has been pressed.
nodelay(stdscr,TRUE);
// Put your code here.
// Keep the following:
leave_curses();
return 0;
}
|