|
CS256 - Fundamentals of Structured Programming
| Displaying exercises/e8/files/p5.c
#include <stdio.h>
#include <curses.h>
#include <stdlib.h>
/**
* Use this function to get a random integer between a and b inclusive.
* ex: R(0,10) -> a random number between 0 and 10
*/
int R(int a, int b)
{
int d = (a < b? b-a : a-b) + 1;
return a + (rand()%d);
}
/**
* make a loop to read a character using getch() and for each character read,
* print "Hello, world!" at a random location using the R() function defined
* above. The y value should range between 0 and LINES-1 and the x value between
* 0 and COLS-10. When a 'q' or 'Q' is read by getch() you should exit the
* loop and then the program.
*/
int main(void)
{
return 0;
}
|