Fortune Telling Collection - Free divination - Writing constellation pairing program code with vb
Writing constellation pairing program code with vb
As far as the current development is concerned, the readability and structure of programs (algorithms) are the mainstream requirements because of the rapid improvement of computer speed and storage space.
I once said that using one line of code to solve a problem, using 1000 lines of code (the example is extreme), has no effect on people's feelings when the computer is running.
There are many solutions to your problem. Of course, arrays and complex If statements will be used.
I'm using a method now. Would you please see if it is simple?
Add two combo boxes Combo 1 and Combo2, a button and a text box Text 1 to the form:
The code is as follows:
Options? specific
Private? XZ? As? line
Private? Sub? Command 1_Click()
Dim? m? As? line
Dim? d? As? line
Dim? d 1? As? date
Dim? d2? As? date
Dim? l? As? integer
m? =? Combo 1。 text
d? =? Combination 2. text
l? =? Instrument (XZ, m)
What if? d? & lt=? Mid(XZ,? l? +? 3,? 3)? then
Text 1。 Words? =? What sign are you in? & amp? Mid(XZ,? l? -? 3,? 3)
other
Text 1。 Words? =? What sign are you in? & amp? Mid(XZ,? l? +? 6,? 3)
End? if
End? submarine
Private? Sub? Form_Load()
Dim? Me? As? integer
Combo 1。 clear
For what? Me? =? 1? Where to? 12
What if? Me? & lt? 10? then
Combo 1。 AddItem? "0"? & amp? CStr (1)? & amp? "the moon"
other
Combo 1。 AddItem? CStr (1)? & amp? "the moon"
End? if
Next? I
Combo 1。 Words? =? Combo 1。 List (0)
Combination 2. clear
For what? Me? =? 1? Where to? 3 1
What if? Me? & lt? 10? then
Combination 2. AddItem? "0"? & amp? CStr (1)? & amp? "day"
other
Combination 2. AddItem? CStr (1)? & amp? "day"
End? if
Next? iCombo2。 Text = Combo2。 List (0)
XZ = "Capricorn 065438+1October 20th Aquarius February 19 Pisces March 20th Aries April 20th Taurus May 2nd1Gemini June 2nd1Cancer"&; _
"July 22nd Leo August 23rd Virgo September 23rd Libra 65438+1October 23rd Scorpio 65438+/October 22nd Sagittarius 65438+February 2nd1Capricorn"
End joint
I didn't use arrays and complicated If statements in this program, but I used Instr () function, which was relatively unreadable.
At the same time, leap year and big month and small month have not been considered in February.
- Previous article:The fortune teller smiled and hesitated. I wonder why there is only 10 left. sorry
- Next article:Famous aphorisms about thinking
- Related articles
- Snake turtle idiom?
- The cure method of submarine wheel is open.
- Calculate fate
- I dreamed of catching crabs and turtles.
- A red thread, a happy marriage in love is like oxygen. What do you mean?
- 93rd Edition of Catalogue of Numbers and Technologies of Sikuquanshu
- Is the reunification of Qin a matter of course or the ability of Qin Shihuang?
- New words, new words and new sentences appeared in 20 10.
- What game is eating chicken?
- Who would like to introduce Hattie civilization, thank humbly?