Discuss Scratch
- Discussion Forums
- » Help with Scripts
- » how do you make a calculator in scratch
- cwkakarsh1896
-
5 posts
how do you make a calculator in scratch
i need to know how to make a calculator
- deck26
-
1000+ posts
how do you make a calculator in scratch
So think about the different things you need and how you'll fit them together.
You need a variable for the current value being input, for example. Each numeric button then effectively multiplies that value by 10 and adds the new digit unless you've already entered a decimal point - so you need to work that out.
Once you can put in a single number you need to work what the basic function keys will do - plus, minus etc. They presumably do something like copy the current value to a separate variable and record what the operation is.
And so on. Coding isn't just about putting code together it's very much about working out how to represent things using code and variables.
The good thing is you can build up a lot of this step by step - get one bit working before moving on to the next bit.
You need a variable for the current value being input, for example. Each numeric button then effectively multiplies that value by 10 and adds the new digit unless you've already entered a decimal point - so you need to work that out.
Once you can put in a single number you need to work what the basic function keys will do - plus, minus etc. They presumably do something like copy the current value to a separate variable and record what the operation is.
And so on. Coding isn't just about putting code together it's very much about working out how to represent things using code and variables.
The good thing is you can build up a lot of this step by step - get one bit working before moving on to the next bit.
- benhause
-
12 posts
how do you make a calculator in scratch
try doing this,
when green flag clickedDONE!
ask [what 2 do] and wait
if <(answer) = [divide ]> then
ask [what number?] and wait
set [a v] to [(answer) ]
ask [what number?] and wait
set [b v] to [(answer) ]
say ((a) / (0b)) for (2) secs
end
- benhause
-
12 posts
how do you make a calculator in scratch
but thats just and example, u can make it like addition subtraction multiplication or stoof, but use variables!
- Superatomsun
-
100+ posts
how do you make a calculator in scratch
You can try using scripts from my calculator. Click i need to know how to make a calculator here.
- deck26
-
1000+ posts
how do you make a calculator in scratch
Please don't necropost. If you have a problem describe what is wrong and share the project but do so in your own new topic. JUST SAYS INFINITY!
- WARMACHINE1111
-
4 posts
how do you make a calculator in scratch
sorry, I think we just did it wrong,
benhause, can you explain how to do an addition, subtraction and multiplication ones too?
benhause, can you explain how to do an addition, subtraction and multiplication ones too?
- WARMACHINE1111
-
4 posts
how do you make a calculator in scratch
also, the problem was the 0b. if the calculator didn't work, try changing 0b to the variable “b”
- codeman1044
-
1000+ posts
how do you make a calculator in scratch
Like deck26 said, please create your own topic and link anything you need to there.
- im-in-me-mumscarbrmm
-
1 post
how do you make a calculator in scratch
THIS DUOEGFUOWFIWTF79 A SA
CAM EGUIEFGUIEGUIFGUORFFHLIWFVEF!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!ssususu!4URYUYHREUFYHEUYFGUIEGIFGEWYGTWEYPlease don't spam or necropost.
- deck26
-
1000+ posts
how do you make a calculator in scratch
Should be pretty obvious to you that spamming and necroposting should be avoided. THIS DUOEGFUOWFIWTF79 A SACAM EGUIEFGUIEGUIFGUORFFHLIWFVEF!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!ssususu!4URYUYHREUFYHEUYFGUIEGIFGEWYGTWEYPlease don't spam or necropost.
- Discussion Forums
- » Help with Scripts
-
» how do you make a calculator in scratch