Programming C, C++, Java, PHP, Ruby, Turing, VB
Computer Science Canada 
Programming C, C++, Java, PHP, Ruby, Turing, VB  

Username:   Password: 
 RegisterRegister   
 How to have the user determine the height and width of a box coded from drawbox?
Index -> Programming, Turing -> Turing Help
View previous topic Printable versionDownload TopicSubscribe to this topicPrivate MessagesRefresh page View next topic
Author Message
nightfeng2




PostPosted: Mon Jan 03, 2011 7:35 pm   Post subject: How to have the user determine the height and width of a box coded from drawbox?

What is it you are trying to achieve?
To have the user enter the width and height of a box

What is the problem you are having?
how does the code work?
because in the drawbox, u can only enter the bottom-left xy axis and top-right xy axis.

Post any relevant code (You may choose to attach the file instead of posting the code if it is too long)
drawbox(x,y,x2,y2)


Please specify what version of Turing you are using
4.1.1
Sponsor
Sponsor
Sponsor
sponsor
Insectoid




PostPosted: Mon Jan 03, 2011 8:16 pm   Post subject: RE:How to have the user determine the height and width of a box coded from drawbox?

What is the difference between x2 and x1? y2 and y1?

This is basic math.
copthesaint




PostPosted: Mon Jan 03, 2011 8:41 pm   Post subject: RE:How to have the user determine the height and width of a box coded from drawbox?

I believe hes saying insectoid that he wants to make a program where the user enters the values for the drawbox and the program will draw it
Insectoid




PostPosted: Mon Jan 03, 2011 8:49 pm   Post subject: RE:How to have the user determine the height and width of a box coded from drawbox?

I know that's what he's trying to do. It's still extremely basic math.

If the user is specifying only the dimensions, then you can specify the base x/y coordinates yourself. Then with some very, very simple math (utilizing only addition!) you can calculate the other 2 points.
nightfeng2




PostPosted: Mon Jan 03, 2011 9:53 pm   Post subject: Re: How to have the user determine the height and width of a box coded from drawbox?

one more question,
let the user specify the height(yradius times 2) and width(xradius times 2) of a circle. Since in drawfilloval, only integers work as the parameters, and when i ask the user for height and width, integers cant be divided by two, without asking the user for the Radius what can i do to have the user specify the height and width
Tony




PostPosted: Mon Jan 03, 2011 9:55 pm   Post subject: RE:How to have the user determine the height and width of a box coded from drawbox?

integers can most certainly be divided by two.
Latest from compsci.ca/blog: Tony's programming blog. DWITE - a programming contest.
andrew.




PostPosted: Tue Jan 04, 2011 9:00 pm   Post subject: RE:How to have the user determine the height and width of a box coded from drawbox?

Look up div in the Turing Help files.
Display posts from previous:   
   Index -> Programming, Turing -> Turing Help
View previous topic Tell A FriendPrintable versionDownload TopicSubscribe to this topicPrivate MessagesRefresh page View next topic

Page 1 of 1  [ 7 Posts ]
Jump to:   


Style:  
Search: