Here is what I need to do, and how far I have gotten with the code. I am stuck with how to incorporate dbRND into the code. FYI. I'm new to coding, DarkGDK, C++ etc. So my terminology grasp is still somewhat limited
If someone could help me out I would appreciate it. Of course I could be way off base here as well
/* Write a program that:
• draw a horizontal line on the screen
• use random numbers (dbRND) for the starting X and ending X coordinates.
• draw a 10 px by 10 px square centered over the lines midpoint
*/
#include "DarkGDK.h"
void DarkGDK()
// variables with known and random values
int startX ; // line random starting X coordinate
int startY = 100; // line starting Y coordinate
int endX ; // line random ending X coordinate
int endY = 100; // line ending Y coordinate
int seed; // to hold a seed value
// variables that hold calculated values
int halfLength; // to hold half the line's length
int midX; // to hold the midpoint's X coordinate
int midY; // to hold the midpoint's Y coordinate
// Reseed the random number generator
seed = dbRandomize(dbTimer());
// draw a line
startX = dbRND); // not sure what to do
endX = dbRND; // not sure what to do
dbLine(startX, startY, endX, endY);
// calculate 1/2 the line's length. Used to find the line's midpoint
halfLength = (endX - startX) /2;
// determine the line's midpoint
midX = startX + halfLength;
midY = startY;
// draw a box at the line's midpoint
dbBox() // will figure out after figuring out the above
Over 40 & Back to School
http://www.SkeeterZ71.com
Most Awesome Blog!