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

Username:   Password: 
 RegisterRegister   
 How to Limit a String? for a calculator
Index -> Programming, Turing -> Turing Help
View previous topic Printable versionDownload TopicSubscribe to this topicPrivate MessagesRefresh page View next topic
Author Message
Sceyef




PostPosted: Sat Dec 27, 2014 1:00 pm   Post subject: How to Limit a String? for a calculator

I am making a calculator. It's the basic Windows Calculator. With +-*/

so like, calculators have limits to how large numbers can be in terms of length

how do i make that limit?

I use Draw.Font to show the calculator's screen. GUI buttons run a procedure to add a character to the string in Draw.Font, for example clicking button with 2 will add "2".
Sponsor
Sponsor
Sponsor
sponsor
Insectoid




PostPosted: Sun Dec 28, 2014 1:08 am   Post subject: RE:How to Limit a String? for a calculator

You're going to have to get the length of the string. You don't need any special commands to do this (an integer that increments every time a number button is pushed will work) but you can use the Length() function as well.

Now that you can get the length, you can figure out how to stop the buttons from working if the string is too long.
Sceyef




PostPosted: Sun Dec 28, 2014 4:19 pm   Post subject: RE:How to Limit a String? for a calculator

Thanks a lot.
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  [ 3 Posts ]
Jump to:   


Style:  
Search: