Fortune Telling Collection - Zodiac Guide - C language, constellation matching problem
C language, constellation matching problem
Month a[0]∈[ 1, 12], a[ 1] means the date is determined according to a[0], and a[0] is 1, 3, 5, 7, 8,/kloc.
When a[0] is 2, a[ 1] cannot exceed 29. If you enter 29, you need to subtract 1 (as the basis for constellation calculation of later date difference).
2) The first function, int sum_day (int* a), takes the input just now as a formal parameter, calculates that M days of n months are K days of this year according to a certain formula, and then returns this date.
3) Because every constellation is 30 days apart (according to February 28th). Let's assume that this number of days is returned by K, and then discuss it by category.
The first one, K.
The second switch ((k- 19)/30) {
Case 0: Water bottle
Case 1: Pisces
........
4) Matching rules, we already know the constellations of both parties, as to whether it is compatible to store the situation with two-dimensional arrays.
int c[ 12][ 12]; The abscissa 0~ 1 1 indicates Aquarius ~ Capricorn respectively, and the ordinate is the same. take for example
A[0][0] is water bottle with water bottle, and c [11] is Capricorn with Capricorn. If c[0][0] stores 1, the water bottle is suitable; if it is 0, it is not suitable. 1 or 0 is set by the programmer.
3) output, (k- 19)/30 is a subscript, such as c [(k 1- 19)/30][, (k2- 19)/30], then this will represent the coordinate data.
It means appropriate, 0 means inappropriate, and k means the k-th day of the year.
- Related articles
- How to play The Grand Duelist's mobile phone game Star Map?
- There are always glib people in life. Which of the twelve constellations likes bragging best?
- Constellation 12 represents Tik Tok songs by Tik Tok singer _ 12.
- May fate analysis of 202 1 genus mouse?
- What constellation is1February 28th, 988 (Gregorian calendar is1April 4th)?
- Thor Constellation _ Thor Constellation Edition Download
- 1990 lunar calendar, the second day of the first month, I don't know what the solar calendar is! What is the constellation?
- How to distinguish the southern sky from the northern sky, and whether the zodiac is in the southern sky or the northern sky?
- 2. What constellation is19? 2. What constellation is19?
- A constellation girl who makes Scorpio crazy.