Fortune Telling Collection - Zodiac Guide - Programming [C++] should use 12 constellation to separate the dates of a year?
Programming [C++] should use 12 constellation to separate the dates of a year?
Then any day of the year, such as May 25th, is the first day of the year. I hope the landlord can make statistics. 1, 3, 5, 7, 8, 10 and 12 have 3 1 day, others have 30 days, and February has 28 or 29 days (for simplicity, it is counted as 28 days).
Finally, according to the above data, two points corresponding to each constellation can be found, and an interval is determined by these two points as a constellation. The following is the program I wrote for the landlord, which can be run in VC++6.0 after being saved as *. C. I have sent the specific program code and running results to your qq mailbox, hoping to help you.
# include & ltstdio.h & gt
int table[ 12]={3 1,28,3 1,30,3 1,30,3 1,30,3 1,30,3 1 }; //Number of days corresponding to the month
Int table1[12] = {20,49,79, 108, 139, 17 1 203,234,265. //The division point of the constellation
String str[ 12]=
{"Aquarius", "Pisces", "Aries", "Taurus", "Gemini", "Cancer",
Leo, Virgo, Libra, Scorpio, Sagittarius, Capricorn,}; //The name of the constellation
Structure date
{
Int month;
Int day;
} date;
Void init_info (date 1)
{
int a,b;
Printf ("Please enter your birth month: \ t");
scanf("%d ",& ampa);
Printf ("Please enter your date of birth: \ t");
scanf("%d ",& ampb);
a = date 1 . month;
b = date 1 . day;
}
Invalid print information (date 1)
{
int key = 0;
for(I = 1; I< date1.month; i++)
{ key+= table[date 1 . month]; }
key+= date 1 . day;
Switch (key)
{
Case keywords & gt = table1[0]&; Key< table 1[ 1]:
{printf("%s\n ",str[0]); Break; }
Case keywords & gt = table1[1]&key< table 1[2]:
{printf("%s\n ",str[ 1]); Break; }
Case keywords & gt = table1[2]&; Key< table 1[3]:
{printf("%s\n ",str[2]); Break; }
Case keywords & gt = table1[3]&; Key< table 1[4]:
{printf("%s\n ",& ampstr[3]); Break; }
Case keywords & gt = table1[4]&; Key< table 1[5]:
{printf("%s\n ",str[4]); Break; }
Case keywords & gt = table1[5]&; Key< table 1[6]:
{printf("%s\n ",& ampstr[5]); Break; }
Case keywords & gt = table1[6]&; Key< table 1[7]:
{printf("%s\n ",& ampstr[6]); Break; }
Case keywords & gt = table1[7]&; Key< table 1[8]:
{printf("%s\n ",str[7]); Break; }
Case keywords & gt = table1[8]&; Key< table 1[9]:
{printf("%s\n ",str[8]); Break; }
Case keywords & gt = table1[9]&; Key< table 1[ 10]:
{printf("%s\n ",str[9]); Break; }
Case keywords & gt = table1[10]&; Key< table 1[ 1 1]:
{printf("%s\n ",str[ 10]); Break; }
Default://65438+born on February 22nd to 65438+ 10/9.
{printf("%s\n ",str[ 1 1]); Break; }
}
}
void main()
{
Date1;
while( 1)
{
init _ info(date 1); //initialization information
print _ info(date 1); //Display constellation
}
}
- Related articles
- Dual personality constellation
- The character of a gay Virgo?
- September, 2022 14, heavenly stems and earthly branches, a newborn, what is the fate and overall good luck?
- Anhui tv, host.
- What is the constellation on the fourth day of December?
- I am this constellation _ I am this constellation.
- What is the IQ of Sagittarius girls?
- Gregorian calendar 2003 1.27 birthday?
- With strength and honor, these constellations are beyond our reach.
- Constellation with high cold teasing ratio and shy switching between three modes at will