Fortune Telling Collection - Zodiac Analysis - Programming C++ should separate the dates of the 12 constellation in a year?
Programming C++ should separate the dates of the 12 constellation in 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
}
}
- Previous article:Clay milk cat simulation course
- Next article:What can junior high school graduates do after graduation?
- Related articles
- What are the most impersonal constellations?
- Susan miller 20 14 horoscope
- What is the love result between the lion girl and the shooter man?
- Good luck in the next two months. 3 constellations, God of Wealth, take refuge in by going up one flight of stairs?
- Gemini tomorrow constellation palace, Gemini tomorrow constellation first network.
- Qu Changgen's main experience
- 165438+1what is the constellation on October 2nd _165438+1what is the constellation on October 2nd?
- Scorpio is the constellation that hurts Scorpio the most. What constellation is Scorpio most vulnerable to?
- Two people making bridal ornaments can enhance their feelings, so what are the tutorials for making bridal headdress?
- The names of ancient girls in the zodiac