Sorry your browser is not supported!

You are using an outdated browser that does not support modern web technologies, in order to use this site please update to a new browser.

Browsers supported include Chrome, FireFox, Safari, Opera, Internet Explorer 10+ or Microsoft Edge.

Dark GDK / Help with dot connecting program

Author
Message
Crook County
6
Years of Service
User Offline
Joined: 9th Aug 2013
Location:
Posted: 11th Aug 2013 20:02
I have to make a program where a user creates dots and it is then written to a file. After which it is read from the file and the dots are connected. I have got a working program except I need help with 2 things. First why do I have to press spacebar twice before it actually draws the lines? Second is there a way I can change this so as not to limit the array to any specific amount of dots? Thanks.
Crook County
6
Years of Service
User Offline
Joined: 9th Aug 2013
Location:
Posted: 12th Aug 2013 09:16 Edited at: 14th Aug 2013 07:20
Posted wrong code. Fixed in later message
BN2 Productions
15
Years of Service
User Offline
Joined: 22nd Jan 2004
Location:
Posted: 12th Aug 2013 09:58
Quote: "First why do I have to press spacebar twice before it actually draws the lines? Second is there a way I can change this so as not to limit the array to any specific amount of dots? Thanks. "


The first question is hard to answer without you posting your code, so that would be my first recommendation.

The second has a couple solutions. You can use the "new" command to create a new array of an arbitrary size. A cleaner solution would be to use an std::vector to store your data. Vectors, in this case, are like dynamic arrays, allowing you to add or remove data as necessary (note that vectors can only add/remove elements from the end, and if you need to do something other than that then you should look into std::deque or std::list).

You can read more about vectors here:http://www.cplusplus.com/reference/vector/vector/

Great Quote:
"Time...LINE??? Time isn't made out of lines...it is made out of circles. That is why clocks are round!" -Caboose
Crook County
6
Years of Service
User Offline
Joined: 9th Aug 2013
Location:
Posted: 12th Aug 2013 16:12
Very absent minded of me, posted completely wrong project. Here is the actualy project the questions are referring to. Thank you

Login to post a reply

Server time is: 2019-09-22 02:29:20
Your offset time is: 2019-09-22 02:29:20