Dad's toolbox: Mental computing exercises

Source: Internet
Author: User

It has been a long time for such a thing:

The computer automatically issues the question of addition, subtraction, multiplication, division, and reads the question in voice mode.

The reason is very simple. Now I am going out to buy some dishes and fruits. When I look for the change, my brain is always short-circuited, which means I cannot calculate it. It is obviously not as easy as before. I want to train my mind on this kind of things. Of course, it's better to buy something later than anyone else ~~~

It is easier for the computer to issue questions, and it can be done with random numbers. speech is very important. If the questions are displayed, it will be much easier and cannot achieve the effect of exercise mental arithmetic. However, I felt a little troublesome about speech. I wanted to write a number, add, subtract, multiply, and divide the pronunciation, and play it in the program, but I never did it because I was too troublesome.

I wrote some VB code over the past two days and suddenly remembered a script using vbs to directly say "I Love you". I found that this pronunciation engine solved this problem, however, it is in English. But for someone who is good at comforting me, I quickly turn this disadvantage into an advantage:

Not only have I practiced my listening to English numbers, but I have also exercised my quick mental computing skills!

 

It is good to play games when you are bored. Although things are simple, there are still some challenges if you really want to quickly respond to and calculate them. It was a little early for my daughter to use this item, but I feel that it may still be used in the future. It is better to take care of the daughter's light in this series ~~~

 

Copy the file to a text file and rename it xxx. vbs. Double-click it to run it:

'
'This is a simple and funny vb script to practice your:
'1. English listening of numbers
'2. Swift calculation of 2 numbers
'You can adjust parameters to change difficulty, as default it only supports des + and-operators
'For numbers between 0-100
'
'Author: Baiyan Huang
'Date: 10/20/2010
'
'============================== Main ========== ======================================
Dim bContinue
BContinue = True
While bContinue
'Generate expression and read aloud!
Dim op1, op2, op
Op1 = GetOperand ()
Op2 = GetOperand ()
Op = GetOperator ()

Dim strExp
StrExp = op1 & op & op2 & "="
CreateObject ("SAPI. SpVoice"). Speak strExp

'Calculate the final result
Dim result
If op = "plus" then
Result = op1 + op2
Elseif op = "minus" then
Result = op1-op2
Elseif op = "multiply" then
Result = op1 * op2
Elseif op = "divided by" then
Result = op1/op2
End If

'Print the expression and result in a clearer manner
StrExp = Replace (strExp, "plus", "+ ")
StrExp = Replace (strExp, "minus ","-")
StrExp = Replace (strExp, "multiply ","*")
StrExp = Replace (strExp, "divided ","/")
BContinue = MsgBox (strExp & result & vbCrLf & "Click OK to continue! ", VbOKCancel) <> vbCancel
WEnd

'==================== Utility Functions ==================================== =
Function GetRandomNum (lowerbound, upperbound)
Call Randomize ()
GetRandomNum = Int (upperbound-lowerbound + 1) * Rnd + lowerbound)
End Function

Function GetOperand ()
GetOperand = GetRandomNum (1,100) '0-100
End Function

Function GetOperator ()
Dim operators (3)
Operators (0) = "plus"
Operators (1) = "minus"
Operators (2) = "multiply"
Operators (3) = "divided"

Dim Index
Index = GetRandomNum (0, 1) 'only include + and-for now
GetOperator = operators (Index)
End Function

 

 

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.