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

Username:   Password: 
 RegisterRegister   
 Recreating Windows calc in turing with GUI, help
Index -> Programming, Turing -> Turing Help
View previous topic Printable versionDownload TopicSubscribe to this topicPrivate MessagesRefresh page View next topic
Author Message
Sceyef




PostPosted: Mon Dec 29, 2014 9:21 am   Post subject: Recreating Windows calc in turing with GUI, help

I tried doing this a few times. I failed

Can someone explain the logic behind doing this? like how its all looped?

i only need +-x/

like windows calc it displays the number when buttons are pressed and inputs each value one at a time
Sponsor
Sponsor
Sponsor
sponsor
Tony




PostPosted: Mon Dec 29, 2014 1:07 pm   Post subject: RE:Recreating Windows calc in turing with GUI, help

Maybe share one of your attempts, and explain in what way it failed?
Latest from compsci.ca/blog: Tony's programming blog. DWITE - a programming contest.
Sceyef




PostPosted: Mon Dec 29, 2014 2:01 pm   Post subject: RE:Recreating Windows calc in turing with GUI, help

It failed because I dont know what im doing.

so basically ill explain what my code does

theres GUI buttons, 0-9, + - x / =

and a little screen for showing numbers

When you click a number button, it adds a digit to a string variable which is displayed. when you press an operator the variable locks as number 1 as a real number using realstr, and the operator is set too. then i got lost because i dont know what to do afterwards
Sceyef




PostPosted: Mon Dec 29, 2014 2:55 pm   Post subject: RE:Recreating Windows calc in turing with GUI, help

Help, I also need it to keep repeatedly allowing more numbers. so you can do 1+1+1 for example... that is getting me confused the most

Edit: Would it be better to avoid GUI and use coordinate buttons?
Tony




PostPosted: Mon Dec 29, 2014 4:30 pm   Post subject: RE:Recreating Windows calc in turing with GUI, help

Maybe avoid GUI completely for now, just build the underlying calculator. Trying to work on that _and_ GUI at the same time is just extra confusing.

It sounds like you are almost there. You've locked in your first number and an operator. Now you need to lock in your second number (should be very similar to locking in first number) and execute the operation.

I think the trick to 1+1+1 is that it's really 1+1+... and it doesn't at all matter what follows. There are no parenthesis and no order of operations. You'll do that first addition the same way as if there was nothing else following it.
Latest from compsci.ca/blog: Tony's programming blog. DWITE - a programming contest.
Sceyef




PostPosted: Mon Dec 29, 2014 7:58 pm   Post subject: RE:Recreating Windows calc in turing with GUI, help

I'm afraid I don't quite get you. What do you mean it doesn't matter what follows?

I think I'm more confused on how to lock a value onto the first number and then switch to locking the next one.

like math should also display after you press for example: 9, 9, +, 8, +
this will output 107 just like on windows calc
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  [ 6 Posts ]
Jump to:   


Style:  
Search: