aaaaaaaaaaaa

物联网205 陈腾 发表于2020年12月21日
<p>#include &lt;stdio.h&gt;</p><p>#include &lt;stdlib.h&gt;</p><p>#include &lt;windows.h&gt;</p><p>#include &lt;time.h&gt;</p><p>#include &lt;stdio.h&gt;</p><p>#include &lt;string.h&gt;</p><p>#include &lt;conio.h&gt;</p><p><br ></p><p>void menu(){</p><p> char flag;</p><p> void function1(char choice);</p><p> void function2(char choice);</p><p> void function3(char choice);</p><p> void function11(char choice);</p><p> void function4(char choice);</p><p> void function5(char choice);</p><p> void function6(char choice);</p><p> void function7(char choice);</p><p> void function8(char choice);</p><p> void function9(char choice);</p><p> void functionA(char choice);</p><p> void functionB(char choice);</p><p> void function0(char choice);</p><p> while(1){</p><p> printf(&quot;------------欢迎使用万年历2.0------------------\n&quot;);</p><p> printf(&quot;1查询某年某月月历\n&quot;);</p><p> printf(&quot;2查询某年月历\n&quot;);</p><p> printf(&quot;3:查询某上半年月历\n&quot;);</p><p> printf(&quot;11:查询某下半年月历\n&quot;);</p><p> printf(&quot;4:查询星座\n&quot;);</p><p> printf(&quot;5:查询某季节月历\n&quot;);&nbsp;</p><p> printf(&quot;6:查询闰年计算方法\n&quot;);</p><p> printf(&quot;7:查询某人活了多少天\n&quot;);</p><p> printf(&quot;8:使用计算器\n&quot;);</p><p> printf(&quot;----------------------------------------------\n&quot;);</p><p> flag=getchar();</p><p> if(flag=='1'){</p><p> function1(flag);</p><p> }else if(flag=='2'){</p><p> function2(flag);</p><p> }else if(flag=='3'){</p><p> function3(flag);</p><p> }else if(flag=='11'){</p><p> function11(flag);&nbsp;</p><p> }else if(flag=='4'){</p><p> function4(flag);</p><p> }else if(flag=='5'){</p><p> function5(flag);</p><p> }else if(flag=='6'){</p><p> function6(flag);</p><p> }else if(flag=='7'){</p><p> function7(flag) ;</p><p> }else if(flag=='8'){</p><p> function8(flag);</p><p> }else if(flag=='9'){</p><p> function9(flag);</p><p> }else if(flag=='0'){</p><p> exit;&nbsp;</p><p> }</p><p> break ;</p><p>}}</p><p>char poem[12][324]={{&quot;故关衰草遍,离别自堪悲。路出寒云外,人归暮雪时。\n少孤为客早,多难识君迟。掩泪空相向,风尘何处期。\n&quot;},</p><p>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; {&quot;?(^_-)绿蚁新醅酒,红泥小火炉。\n晚来天欲雪,能饮一杯无??(^_-)\n&quot;},</p><p> {&quot;造物无言却有情,每于寒尽觉春生。\n千红万紫安排著,只待新雷第一声。\n&quot;},</p><p> {&quot;世味年来薄似纱,谁令骑马客京华。小楼一夜听春雨,深巷明朝卖杏花。\n矮纸斜行闲作草,晴窗细乳戏分茶。素衣莫起风尘叹,犹及清明可到家。\n&quot;},&nbsp;</p><p> {&quot;夜热依然午热同,开门小立月明中。\n竹深树密虫鸣处,时有微凉不是风。\n&quot;},&nbsp;</p><p> {&quot;携扙来追柳外凉,画桥南畔倚胡床。\n月明船笛参差起,风定池莲自在香。\n&quot;},</p><p> {&quot;纷纷红紫已成尘,布谷声中夏令新。\n夹路桑麻行不尽,始知身是太平人。\n&quot;},</p><p> {&quot;银烛秋光冷画屏,轻罗小扇扑流萤。\n天街夜色凉如水,卧看牵牛织女星 。\n&quot;},&nbsp;</p><p> {&quot;空山新雨后,天气晚来秋。明月松间照,清泉石上流。 \n竹喧归浣女,莲动下渔舟。随意春芳歇,王孙自可留。\n&quot;},&nbsp;</p><p> {&quot;桂魄初生秋露微,轻罗已薄未更衣。\n银筝夜久殷勤弄,心怯空房不忍归。\n &quot;},</p><p> {&quot;花门楼前见秋草,岂能贫贱相看老。\n&quot;},</p><p> {&quot;战哭多新鬼,愁吟独老翁。乱云低薄暮,急雪舞回风。\n瓢弃尊无绿,炉存火似红。数州消息断,愁坐正书空。\n&quot;},}; </p><p>int leapyear(int year){</p><p> return(year%4==0&amp;&amp;year%100!=0||year%400==0);}</p><p>int daysofmonth(int year,int month){</p><p> int days;</p><p> if(month==1||month==3||month==5||month==7||month==8||month==10||month==12){</p><p> days=31; </p><p> }else if(month==4||month==6||month==9||month==11){</p><p> days=30; </p><p> }else if(month==2){</p><p> if(year%4==0&amp;&amp;year%100!=0||year%400==0){</p><p> days=29;</p><p> }else{</p><p> days=28;</p><p> }</p><p> }</p><p> return days;</p><p>}&nbsp;</p><p>int daysofmonth(int year,int month,int days){</p><p> switch(month)</p><p> {</p><p> case 1:</p><p> case 3:</p><p> case 5:</p><p> case 7:</p><p> case 8:</p><p> case 10:</p><p> case 12:</p><p> days=31;</p><p> break;</p><p> case 4:</p><p> case 6:</p><p> case 9:</p><p> case 11:</p><p> days=30;</p><p> break;</p><p> case 2:</p><p> days=(leapyear(year))?29:28;</p><p> break;</p><p> }</p><p> return days;</p><p>}</p><p>int sumofday(int year,int month){</p><p> int sum=0;</p><p> sum+=(year-1)*365;</p><p> sum+=(year-1)/400*97;</p><p> sum+=(year-1)%400/100*24;</p><p> sum+=(year-1)%100/4;</p><p> for(int i=1;i&lt;month;i++){</p><p> sum+=daysofmonth(year,i);</p><p> }</p><p> return sum;</p><p>}</p><p>void displayofmonth(int year,int month,int days){</p><p> int sum;</p><p> int temp;</p><p> int sumofday(int year,int month);</p><p> sum = sumofday(year,month);</p><p> temp = sum%7;</p><p> temp++;</p><p>&nbsp; printf(&quot;日\t一\t二\t三\t四\t五\t六\n&quot;);</p><p>&nbsp; printf(&quot;==================================================\n&quot;);</p><p> for(int i=1;i&lt;=temp;printf(&quot;\t&quot;),i++);</p><p> if(temp==7){</p><p> printf(&quot;\r&quot;);</p><p> }</p><p> for(int i=1;i&lt;=days;i++){</p><p> printf(&quot;%d\t&quot;,i); </p><p>&nbsp; if((i+temp)%7==0){</p><p> printf(&quot;\n&quot;); </p><p> }</p><p> } </p><p> printf(&quot;\n\n&quot;);</p><p>}</p><p>void displayOfMonth(int year,int month,int days){</p><p>&nbsp; &nbsp; int sum;</p><p>&nbsp; &nbsp; int temp;</p><p>&nbsp; &nbsp; int sumOfDay(int year,int month);</p><p>&nbsp; &nbsp; sum = sumOfDay(year,month);</p><p>&nbsp; &nbsp; temp = sum%7;</p><p>&nbsp; &nbsp; temp++;</p><p>&nbsp; &nbsp; printf(&quot;%d-%d\n&quot;,year,month);</p><p>&nbsp; &nbsp; printf(&quot;%s\n&quot;,poem[month-1]);</p><p>&nbsp; &nbsp; printf(&quot;==================================================\n&quot;);</p><p>&nbsp; &nbsp; printf(&quot;日\t一\t二\t三\t四\t五\t六\n&quot;);</p><p>&nbsp; &nbsp; printf(&quot;==================================================\n&quot;);</p><p>&nbsp; &nbsp; system(&quot;color 0f&quot;);</p><p> /*if(temp==7){</p><p>&nbsp; &nbsp; &nbsp; &nbsp; temp=o;</p><p>&nbsp; &nbsp; }*/</p><p>&nbsp; &nbsp; for(int i=1;i&lt;=temp;printf(&quot;\t&quot;),i++);</p><p>&nbsp; &nbsp; if(temp==7){</p><p>&nbsp; &nbsp; &nbsp; &nbsp; printf(&quot;\r&quot;);</p><p>&nbsp; &nbsp; }</p><p>&nbsp; &nbsp; for(int i=1;i&lt;=days;i++){&nbsp; &nbsp;&nbsp;</p><p>&nbsp; &nbsp; &nbsp; &nbsp; printf(&quot;%d\t&quot;,i);</p><p>&nbsp; &nbsp; &nbsp; &nbsp; if((i+temp)%7==0){</p><p>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; printf(&quot;\n&quot;);</p><p>&nbsp; &nbsp; &nbsp; &nbsp; }</p><p>&nbsp; &nbsp; }</p><p>&nbsp; &nbsp; printf(&quot;\n\n&quot;);</p><p>}</p><p>int daysOfMonth(int year,int month,int days){</p><p>&nbsp; &nbsp; //int days;</p><p>&nbsp; &nbsp; switch(month)</p><p>&nbsp; &nbsp; {</p><p>&nbsp; &nbsp; &nbsp; &nbsp; case 1:</p><p>&nbsp; &nbsp; &nbsp; &nbsp; case 3:</p><p>&nbsp; &nbsp; &nbsp; &nbsp; case 5:</p><p>&nbsp; &nbsp; &nbsp; &nbsp; case 7:</p><p>&nbsp; &nbsp; &nbsp; &nbsp; case 8:</p><p>&nbsp; &nbsp; &nbsp; &nbsp; case 10:</p><p>&nbsp; &nbsp; &nbsp; &nbsp; case 12:</p><p>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; days=31;</p><p>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; break;</p><p>&nbsp; &nbsp; &nbsp; &nbsp; case 4:</p><p>&nbsp; &nbsp; &nbsp; &nbsp; case 6:</p><p>&nbsp; &nbsp; &nbsp; &nbsp; case 9:</p><p>&nbsp; &nbsp; &nbsp; &nbsp; case 11:</p><p>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; days=30;</p><p>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; break;</p><p>&nbsp; &nbsp; &nbsp; &nbsp; case 2:</p><p>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; /*if(year%4==0&amp;&amp;year%100!=0||year%400==0){</p><p>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; days=29;</p><p>&nbsp; &nbsp; &nbsp; &nbsp; }else{</p><p>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; days=28;</p><p>&nbsp; &nbsp; &nbsp; &nbsp; }*/</p><p>&nbsp; &nbsp; &nbsp; &nbsp; days=(leapyear(year))?29:28;</p><p>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; break;</p><p>&nbsp; &nbsp; }</p><p>&nbsp; &nbsp; return days;</p><p>}</p><p>int sumOfDay(int year,int month){</p><p>&nbsp; &nbsp; int sum=0;</p><p>&nbsp; &nbsp; int daysOfMonth[2][12]={{0,31,59,120,151,181,212,243,273,304,334},</p><p>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; {0,31,60,91,121,152,182,213,244,274,305,335}};</p><p>&nbsp; &nbsp; sum+=(year-1)*365;</p><p>&nbsp; &nbsp; sum+=(year-1)/400*97;</p><p>&nbsp; &nbsp; sum+=(year-1)%400/100*24;</p><p>&nbsp; &nbsp; sum+=(year-1)%100/4;</p><p>&nbsp; &nbsp; //for(int i=1;i&lt;month;i++){</p><p>&nbsp; &nbsp; &nbsp; &nbsp; //sum+=daysOfMonth(year,i);</p><p>&nbsp; &nbsp; &nbsp; &nbsp;sum+=daysOfMonth[leapyear(year)][month-1];</p><p>&nbsp; &nbsp; //}</p><p>&nbsp; &nbsp; /*if(leapyear(year)&amp;&amp;month&gt;2){</p><p>&nbsp; &nbsp; &nbsp; &nbsp; sum++;</p><p>&nbsp; &nbsp; }*/</p><p>&nbsp; &nbsp; return sum;</p><p>}</p><p><br ></p><p><br ></p><p>void function1(char choice){</p><p> system(&quot;cls&quot;);</p><p> int year;</p><p> int month;</p><p> printf(&quot;请输入年份、月份,输入格式为:(?-?)\n&quot;); </p><p> scanf(&quot;%d-%d&quot;,&amp;year,&amp;month);</p><p> displayofmonth(year,month,daysofmonth(year,month,0));</p><p> Sleep(2000);</p><p> </p><p>}</p><p> long sum(int y,int m,int d)</p><p>{</p><p>&nbsp;int x[13]={0,31,28,31,30,31,30,31,31,30,31,30,31};</p><p>&nbsp;long i,s=0;</p><p>&nbsp;for(i=1;i&lt;y;i++)</p><p>&nbsp; if(i%4==0&amp;&amp;i%100!=0||i%400==0) s+=366;</p><p>&nbsp; else s+=365;</p><p><br ></p><p><br ></p><p>&nbsp;if(y%4==0&amp;&amp;y%100!=0||y%400==0)x[2]=29;</p><p>&nbsp;for(i=1;i&lt;m;i++)</p><p>&nbsp; s+=x[i];</p><p>&nbsp;s+=d;</p><p>&nbsp;return s;</p><p>}</p><p>int IsLeap (int year) {</p><p>&nbsp; &nbsp; if((year%4==0)&amp;&amp; (year%100!=0) || (year%400==0))</p><p>&nbsp; &nbsp; &nbsp; return 1;</p><p>&nbsp; &nbsp; else</p><p>&nbsp; &nbsp; &nbsp; return 0;</p><p>}</p><p>int FirstWeeday (int year) {</p><p>&nbsp; &nbsp; int days = (year-1)*365 + (year-1)/4 - (year-100)/100 + (year-1)/400;</p><p>&nbsp; &nbsp; return days%7;</p><p>}</p><p>void PrintWeedTitl () {</p><p>&nbsp; &nbsp; int i;</p><p>&nbsp; &nbsp; for(i = 0;i&lt;7;i++){</p><p>&nbsp; &nbsp; &nbsp; &nbsp; switch(i) {</p><p>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; case 0 : printf(&quot;&nbsp; Sun&nbsp; &quot;);break;</p><p>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; case 1 : printf(&quot;Mon&nbsp; &quot;);break;</p><p>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; case 2 : printf(&quot;Tue&nbsp; &quot;);break;</p><p>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; case 3 : printf(&quot;Wed&nbsp; &quot;);break;</p><p>
2 回复

    1楼

  • 物联网205 陈腾 发表于2020年12月21日
    0 | 0 | 举报
    <p>&nbsp; PrintMonTitl(m);</p><p>&nbsp; &nbsp; &nbsp; PrintWeedTitl();</p><p>&nbsp; &nbsp; &nbsp; for(d=1;d&lt;=MONTH[m];d++) {</p><p>&nbsp; &nbsp; &nbsp; &nbsp; if(d == 1) {</p><p>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; for(i = 0;i&lt;firstwed;i++)</p><p>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; printf(&quot;%5c&quot;,c);</p><p>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; printf(&quot;%5d&quot;,d);</p><p>&nbsp; &nbsp; &nbsp; &nbsp; }</p><p>&nbsp; &nbsp; &nbsp; &nbsp; else {</p><p>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; printf(&quot;%5d&quot;,d);</p><p>&nbsp; &nbsp; &nbsp; &nbsp; }&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;</p><p>&nbsp; &nbsp; &nbsp; &nbsp; if((firstwed+d-1)%7 == 6) printf(&quot;\n&quot;);</p><p>&nbsp; &nbsp; &nbsp; }&nbsp;</p><p>&nbsp; &nbsp; &nbsp; firstwed = (firstwed + MONTH[m])%7;</p><p>&nbsp; &nbsp; &nbsp; printf(&quot;\n&quot;);</p><p>&nbsp; &nbsp;}</p><p><br ></p><p>}</p><p>void function2(char choice){</p><p> system(&quot;cls&quot;);</p><p> int nothing;</p><p> printf(&quot;请输入任意年份\n&quot;);</p><p> scanf(&quot;%d&quot;,&amp;nothing);</p><p> int year = 2016;</p><p>&nbsp; &nbsp; PrintYear(year);</p><p>}</p><p>void function3(char choice){</p><p> system(&quot;cls&quot;);</p><p> int year;</p><p> int month;</p><p> int half;</p><p> printf(&quot;请输入年份(上半年)\n&quot;); </p><p><br ></p><p> system(&quot;cls&quot;);</p><p> scanf(&quot;%d&quot;,&amp;year);</p><p><br ></p><p> getchar();</p><p><br ></p><p> for(int i=1;i&lt;=6;i++){</p><p><br ></p><p> displayofmonth(year,i,daysofmonth(year,i));</p><p><br ></p><p> }</p><p><br ></p><p> Sleep(3000);</p><p><br ></p><p>&nbsp; &nbsp; system(&quot;cls&quot;);</p><p>}</p><p>void function11(char choice){</p><p> system(&quot;cls&quot;);</p><p><br ></p><p> int year;</p><p><br ></p><p> </p><p><br ></p><p> scanf(&quot;%d&quot;,&amp;year);</p><p><br ></p><p> getchar();</p><p><br ></p><p> for(int j=7;j&lt;=12;j++){</p><p><br ></p><p> displayofmonth(year,j,daysofmonth(year,j,0));</p><p><br ></p><p> }</p><p><br ></p><p> Sleep(4000);</p><p><br ></p><p>&nbsp; &nbsp; system(&quot;cls&quot;);</p><p>}</p><p>void function4(char choice)</p><p><br ></p><p>&nbsp;{</p><p> system(&quot;cls&quot;);</p><p> system(&quot;color F5&quot;);</p><p>&nbsp; &nbsp; &nbsp;int year,month,day;</p><p>&nbsp; &nbsp; &nbsp;printf(&quot;请输入年-月-日\n&quot;);</p><p><br ></p><p>&nbsp; &nbsp; &nbsp;scanf(&quot;%d-%d-%d&quot;,&amp;year,&amp;month,&amp;day);&nbsp; &nbsp;</p><p><br ></p><p>&nbsp; &nbsp; &nbsp;if((month==12&amp;&amp;day&gt;=21)||(month==1&amp;&amp;day&lt;=19))</p><p><br ></p><p>&nbsp; &nbsp; &nbsp;{</p><p><br ></p><p>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;printf(&quot;摩羯座&quot;);</p><p><br ></p><p>&nbsp; &nbsp; &nbsp;}</p><p><br ></p><p>&nbsp; &nbsp; &nbsp;else if((month==1&amp;&amp;day&gt;=19)||(month==2&amp;&amp;day&lt;=18))</p><p><br ></p><p>&nbsp; &nbsp; &nbsp;{</p><p><br ></p><p>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;printf(&quot;水瓶座&quot;);</p><p><br ></p><p>&nbsp; &nbsp; &nbsp;}</p><p><br ></p><p>&nbsp; &nbsp; &nbsp;else if((month==2&amp;&amp;day&gt;=18)||(month==3&amp;&amp;day&lt;=20))</p><p><br ></p><p>&nbsp; &nbsp; printf(&quot;双鱼座&quot;);</p><p><br ></p><p>&nbsp; &nbsp; &nbsp; &nbsp; else if((month==3&amp;&amp;day&gt;=21)||(month==4&amp;&amp;day&lt;=19))</p><p><br ></p><p>&nbsp; &nbsp; &nbsp; &nbsp; printf(&quot;白羊座:热情活泼,精力充沛,慷慨大方,行动力强,不会犹犹豫豫,喜欢竞争,敢做敢当,不畏挫折,凡事都要争第一。白羊男是说一不二的纯爷们,白羊女就是典型的女汉子。&quot;);</p><p><br ></p><p>&nbsp; &nbsp; &nbsp; &nbsp; else if((month==4&amp;&amp;day&gt;=20)||(month==5&amp;&amp;day&lt;=20))</p><p><br ></p><p>&nbsp; &nbsp; &nbsp; &nbsp; printf(&quot;金牛座:沉稳踏实,不喜欢变动,有敏锐洞察力,行事谨慎,思虑周全,不打没把握的仗,喜欢享受的生活和环境,是一名理财高手。金牛男有大男人的倾向,金牛女爱投资自己。&quot;);</p><p><br ></p><p>&nbsp; &nbsp; &nbsp; &nbsp; else if((month==5&amp;&amp;day&gt;=21)||(month==6&amp;&amp;day&lt;=21))</p><p><br ></p><p>&nbsp; &nbsp; &nbsp; &nbsp; printf(&quot;双子座:思维敏捷,反应迅速,适应力强,对新鲜事物的接受能力也很强,口齿伶俐,风趣机智,善于交流。双子男表面很花心其实深情,双子女喜欢求新求变。&quot;);</p><p><br ></p><p>&nbsp; &nbsp; &nbsp; &nbsp; else if((month==6&amp;&amp;day&gt;=22)||(month==7&amp;&amp;day&lt;=22))</p><p><br ></p><p>&nbsp; &nbsp; &nbsp; &nbsp; printf(&quot;巨蟹座:心思细密,行事谨慎,有想法但不轻易表现,情感丰富,待人友善,善解人意,家庭观念浓厚,重情重义,有强烈的责任心和奉献精神。巨蟹男顾家,巨蟹女超有爱。&quot;);</p><p><br ></p><p>&nbsp; &nbsp; &nbsp; &nbsp; else if((month==7&amp;&amp;day&gt;=23)||(month==8&amp;&amp;day&lt;=22))</p><p><br ></p><p>&nbsp; &nbsp; &nbsp; &nbsp; printf(&quot;狮子座:喜欢被粉丝膜拜,待人也慷慨大方,胸怀坦荡,自信自强,很有主见,做事雷厉风行,喜欢挑战权威,永不服输,有较强领导能力,有王者风范。狮子男爱面子,狮子女讲义气。&quot;);</p><p><br ></p><p>&nbsp; &nbsp; &nbsp; &nbsp; else if((month==8&amp;&amp;day&gt;=23)||(month==9&amp;&amp;day&lt;=22))</p><p><br ></p><p>&nbsp; &nbsp; &nbsp; &nbsp; printf(&quot;处女座:思维敏捷,乐于助人,为人谦虚,待人真诚,但会保持距离,处事不惊,办事谨慎,冷静,理性,耐心,善于分析和研究,对自己要求很高,凡事要求做到尽善尽美,是个完美主义者。处女男毅力坚强,处女女求知欲强。&quot;);</p><p><br ></p><p>&nbsp; &nbsp; &nbsp; &nbsp; else if((month==9&amp;&amp;day&gt;=23)||(month==10&amp;&amp;day&lt;=23))</p><p><br ></p><p>&nbsp; &nbsp; &nbsp; &nbsp; printf(&quot;天秤座:待人友善,优雅气质,谈吐得体,善于察言观色,交际能力强,是个谈判高手。追求外表光鲜,喜欢美丽的事物,凡事要求公平公正,最怕冲突、不和谐。天秤男容易因自己而忽略别人,天秤女喜欢被陪伴的感觉。&quot;);</p><p><br ></p><p>&nbsp; &nbsp; &nbsp; &nbsp; else if((month==10&amp;&amp;day&gt;=24)||(month==11&amp;&amp;day&lt;=22))</p><p><br ></p><p>&nbsp; &nbsp; &nbsp; &nbsp; printf(&quot;天蝎座:外表低调深沉,实则企图心旺盛,充满神秘感,处事非常理性,明察秋毫,注重过程,不会轻易放弃,有毅力,有责任感,有敏锐观察力,凡事都亲力亲为。天蝎男自我主义色彩很强烈,天蝎女的自我保护意识很强。&quot;);</p><p><br ></p><p>&nbsp; &nbsp; &nbsp; &nbsp; else</p><p><br ></p><p>&nbsp; &nbsp; &nbsp; &nbsp; printf(&quot;射手座:乐观开朗,勇敢独立,崇尚自由,喜欢冒险,精力充沛,反应灵敏,处事果断,办事效率高,为人坦率,不拘小节,幽默风趣,待人友善,很讲义气,朋友颇多。射手男讨厌束缚爱自由,射手女不耍心计但是任性&quot;);</p><p><br ></p><p> Sleep(3000);</p><p>&nbsp; &nbsp; &nbsp; &nbsp; system(&quot;cls&quot;);&nbsp;</p><p><br ></p><p>&nbsp;}</p><p>void function5(char choice){</p><p> system(&quot;cls&quot;);</p><p> system(&quot;color B5&quot;);</p><p> int year;</p><p>&nbsp; &nbsp; int season;</p><p>&nbsp; &nbsp; printf(&quot;请输入年份、季节。(づ ̄3 ̄)づ╭?~\n&quot;) ;</p><p>&nbsp; &nbsp; scanf(&quot;%d-%d&quot;,&amp;year,&amp;season);</p><p>&nbsp; &nbsp; for(int i=(season-1)*3+3;i&lt;=season*3+2;i++){</p><p>&nbsp; &nbsp; &nbsp; &nbsp; int tempmonth=i;</p><p>&nbsp; &nbsp; &nbsp; &nbsp; int tempyear=year;</p><p>&nbsp; &nbsp; &nbsp; &nbsp; if(tempmonth&gt;12){</p><p>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; tempmonth-=12;</p><p>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; tempyear++;</p><p>&nbsp; &nbsp; &nbsp; &nbsp; }</p><p>&nbsp; &nbsp; &nbsp; &nbsp; displayOfMonth(tempyear,tempmonth,daysOfMonth(year,tempmonth,0));</p><p>&nbsp; &nbsp; }</p><p>&nbsp; &nbsp; system(&quot;color F5&quot;);</p><p>&nbsp; &nbsp; Sleep(3000);</p><p>&nbsp; &nbsp;&nbsp;</p><p>}&nbsp;</p><p>void function6(char choice){</p><p> system(&quot;cls&quot;);</p><p> printf(&quot;1、普通年能被4整除的为闰年。\n2、世纪年能被400整除的是闰年\n&quot;);</p><p> printf(&quot;详情计算请进入function8\n&quot;);</p><p> Sleep(3000);</p><p>}&nbsp;</p><p>void function7(char choice){</p><p> system(&quot;cls&quot;);</p><p><br ></p><p>&nbsp;int y1,m1,d1,y2,m2,d2;</p><p>&nbsp;long s1,s2;</p><p>&nbsp;printf(&quot;输入年-月-日:&quot;);</p><p>&nbsp;scanf(&quot;%d-%d-%d&quot;,&amp;y1,&amp;m1,&amp;d1);</p><p>&nbsp;printf(&quot;输入年-月-日:&quot;);</p><p>&nbsp;scanf(&quot;%d-%d-%d&quot;,&amp;y2,&amp;m2,&amp;d2);</p><p>&nbsp;s1=sum(y1,m1,d1);</p><p>&nbsp;s2=sum(y2,m2,d2);</p><p>&nbsp;printf(&quot;你已经活了这么些天:%ld\n&quot;,s2-s1);</p><p><br ></p><p><br ></p><p><br ></p><p>}&nbsp;</p><p>void function8(char choice){</p><p> system(&quot;cls&quot;);</p><p>&nbsp; &nbsp; char option;&nbsp;</p><p>&nbsp; &nbsp; float a,b,result;</p><p>&nbsp; &nbsp; printf(&quot;请输入第一个数(运算符)第二个数:\n&quot;);&nbsp;</p><p>&nbsp; &nbsp; scanf(&quot;%f%c%f\n&quot;,&amp;a,&amp;option,&amp;b);&nbsp;</p><p>&nbsp; &nbsp; system (&quot;title 简单计算器 By:Sky_木子李&quot;);&nbsp;</p><p>&nbsp; &nbsp; switch(option)&nbsp;</p><p>&nbsp; &nbsp; {&nbsp;</p><p>&nbsp; &nbsp; case '+': result=a+b; break;&nbsp;</p><p>&nbsp; &nbsp; case '-': result=a-b; break;&nbsp;</p><p>&nbsp; &nbsp; case '*': result=a*b; break;&nbsp;</p><p>&nbsp; &nbsp; case '/': result=a/b; break;&nbsp;</p><p>&nbsp; &nbsp; default:printf(&quot;有误,请重新输入&quot;);&nbsp;</p><p>&nbsp; &nbsp; }&nbsp;&nbsp;</p><p>&nbsp; &nbsp; printf(&quot;%.2f%c%.2f=%.2f&quot;,a,option,b,result);</p><p>&nbsp; &nbsp; Sleep(1000);</p><p>}&nbsp;</p><p>void function9(char choice){</p><p> int number;</p><p> system(&quot;cls&quot;);</p><p> system(&quot;color 1A&quot;);</p><p> scanf(&quot;%d&quot;,&amp;number);</p><p> if(number&gt;0){</p><p> int i;</p><p> i=number;</p><p> for(;i&gt;0;i++){</p><p> printf(&quot;%d&quot;,i);</p><p> }</p><p> }</p><p> </p><p>}</p><p>unsigned int LunarCalendarDay;</p><p>unsigned int LunarCalendarTable[199] =</p><p>{</p><p> 0x04AE53,0x0A5748,0x5526BD,0x0D2650,0x0D9544,0x46AAB9,0x056A4D,0x09AD42,0x24AEB6,0x04AE4A,/*1901-1910*/</p><p> 0x6A4DBE,0x0A4D52,0x0D2546,0x5D52BA,0x0B544E,0x0D6A43,0x296D37,0x095B4B,0x749BC1,0x049754,/*1911-1920*/</p><p> 0x0A4B48,0x5B25BC,0x06A550,0x06D445,0x4ADAB8,0x02B64D,0x095742,0x2497B7,0x04974A,0x664B3E,/*1921-1930*/</p><p> 0x0D4A51,0x0EA546,0x56D4BA,0x05AD4E,0x02B644,0x393738,0x092E4B,0x7C96BF,0x0C9553,0x0D4A48,/*1931-1940*/</p><p> 0x6DA53B,0x0B554F,0x056A45,0x4AADB9,0x025D4D,0x092D42,0x2C95B6,0x0A954A,0x7B4ABD,0x06CA51,/*1941-1950*/</p><p> 0x0B5546,0x555ABB,0x04DA4E,0x0A5B43,0x352BB8,0x052B4C,0x8A953F,0x0E9552,0x06AA48,0x6AD53C,/*1951-1960*/</p><p> 0x0AB54F,0x04B645,0x4A5739,0x0A574D,0x052642,0x3E9335,0x0D9549,0x75AABE,0x056A51,0x096D46,/*1961-1970*/</p><p> 0x54AEBB,0x04AD4F,0x0A4D43,0x4D26B7,0x0D254B,0x8D52BF,0x0B5452,0x0B6A47,0x696D3C,0x095B50,/*1971-1980*/</p><p> 0x049B45,0x4A4BB9,0x0A4B4D,0xAB25C2,0x06A554,0x06D449,0x6ADA3D,0x0AB651,0x093746,0x5497BB,/*1981-1990*/</p><p> 0x04974F,0x064B44,0x36A537,0x0EA54A,0x86B2BF,0x05AC53,0x0AB647,0x5936BC,0x092E50,0x0C9645,/*1991-2000*/</p><p> 0x4D4AB8,0x0D4A4C,0x0DA541,0x25AAB6,0x056A49,0x7AADBD,0x025D52,0x092D47,0x5C95BA,0x0A954E,/*2001-2010*/</p><p> 0x0B4A43,0x4B5537,0x0AD54A,0x955ABF,0x04BA53,0x0A5B48,0x652BBC,0x052B50,0x0A9345,0x474AB9,/*2011-2020*/</p><p> 0x06AA4C,0x0AD541,0x24DAB6,0x04B64A,0x69573D,0x0A4E51,0x0D2646,0x5E933A,0x0D534D,0x05AA43,/*2021-
    物联网205 陈腾 发表于2020年12月21日
    添加评论
  • 2楼

  • 物联网205 陈腾 发表于2020年12月21日
    0 | 0 | 举报
    <p> Spring_NY -= StaticDayCount;</p><p> index--;</p><p> if (flag == 0)</p><p> month--;</p><p> if (month == ((LunarCalendarTable[year - 1901] &amp; 0xF00000) &gt;&gt; 20))</p><p> flag = ~flag;</p><p> if ( ( LunarCalendarTable[year - 1901] &amp; (0x80000 &gt;&gt; (index-1)) ) ==0)</p><p> StaticDayCount = 29;</p><p> else</p><p> StaticDayCount = 30;</p><p> }</p><p> day = StaticDayCount - Spring_NY + 1;</p><p> }</p><p> LunarCalendarDay |= day;</p><p> LunarCalendarDay |= (month &lt;&lt; 6);</p><p> if (month == ((LunarCalendarTable[year - 1901] &amp; 0xF00000) &gt;&gt; 20))</p><p> return 1;</p><p> else</p><p> return 0;</p><p>}</p><p>void BackGround(unsigned int ForeColor = 7, unsigned int BackGroundColor = 0) {</p><p>&nbsp; HANDLE handle = GetStdHandle(STD_OUTPUT_HANDLE);&nbsp; //获取控制台的句柄</p><p>&nbsp; SetConsoleTextAttribute(handle, ForeColor + BackGroundColor * 0x10);//改变当前光标的背景和字体颜色</p><p>}</p><p>&nbsp;</p><p>//**改变光标的位置**//</p><p>void gotoxy(int x, int y) {</p><p>&nbsp; HANDLE handle;</p><p>&nbsp; COORD coord;&nbsp; &nbsp;//获取坐标轴结构体</p><p>&nbsp; coord.X = x;</p><p>&nbsp; coord.Y = y;</p><p>&nbsp; handle = GetStdHandle(STD_OUTPUT_HANDLE);&nbsp; //获取控制台句柄,值为-11</p><p>&nbsp; SetConsoleCursorPosition(handle, coord);&nbsp; &nbsp;//移动光标到x,y处</p><p>}</p><p>&nbsp;</p><p>//**初始化地图数据**//</p><p>void restart(int bk[20][20], int look[4], int move[20][20]) {</p><p>&nbsp; //bk为总的地图数据记录整个地图,为1时表示墙体,为2时表示果实,为3时表示蛇</p><p>&nbsp; //look记录数据,为0时表示朝向,为1时表示长度,为3时表示胜负情况,为4表示分数</p><p>&nbsp; //move记录蛇走过的路程,用来打印蛇时判断用</p><p>&nbsp; int pp, qq;&nbsp; //用来记录获取的随机坐标</p><p>&nbsp; //接下来要初始化整个地图//</p><p>&nbsp; for(int i=0;i&lt;=16;i++)</p><p>&nbsp; &nbsp; for (int j = 0; j &lt;= 16; j++) {</p><p>&nbsp; &nbsp; &nbsp; if (i == 0 || i == 16 || j == 0 || j == 16)&nbsp; bk[i][j] = 1;//1表示墙体</p><p>&nbsp; &nbsp; &nbsp; else bk[i][j] = 0; //0表示什么都没有</p><p>&nbsp; &nbsp; &nbsp; move[i][j] = 0;&nbsp; &nbsp; //该数组用来记录蛇移动的轨迹</p><p>&nbsp; &nbsp; }</p><p>&nbsp; //将蛇初始化在8,8坐标上</p><p>&nbsp; bk[8][8] = 3;</p><p>&nbsp; move[8][8] = 1;//则此时8,8,上的轨迹就应该记录为1</p><p>&nbsp; move[0][0] = 1;//用此来记录步数</p><p>&nbsp; pp = rand() % 15 + 1;//范围是1-15</p><p>&nbsp; qq = rand() % 15 + 1;</p><p>&nbsp; bk[pp][qq] = 2;//表示这个位置有果实了</p><p>&nbsp; look[0] = 1;//表示朝向,向上</p><p>&nbsp; look[1] = 1;//表示长度</p><p>&nbsp; look[2] = 0;//当为1是表示失败</p><p>&nbsp; look[3] = 0;//记录得分</p><p>&nbsp; //接下来要绘制地图//</p><p>&nbsp; for(int i=0;i&lt;=16;i++)</p><p>&nbsp; &nbsp; for (int j = 0; j &lt;= 16; j++) {</p><p>&nbsp; &nbsp; &nbsp; gotoxy(i * 2, j);//光标移动,每个光标都是矩形</p><p>&nbsp; &nbsp; &nbsp; switch (bk[i][j]) {</p><p>&nbsp; &nbsp; &nbsp; case 0:</p><p>&nbsp; &nbsp; &nbsp; &nbsp; BackGround(0, 0);</p><p>&nbsp; &nbsp; &nbsp; &nbsp; break;//如果没有东西打印黑色</p><p>&nbsp; &nbsp; &nbsp; case 1:</p><p>&nbsp; &nbsp; &nbsp; &nbsp; BackGround(0, 1);</p><p>&nbsp; &nbsp; &nbsp; &nbsp; break;//墙打印蓝色</p><p>&nbsp; &nbsp; &nbsp; case 2:</p><p>&nbsp; &nbsp; &nbsp; &nbsp; BackGround(0, 2);</p><p>&nbsp; &nbsp; &nbsp; &nbsp; break;//果实打印绿色</p><p>&nbsp; &nbsp; &nbsp; case 3:</p><p>&nbsp; &nbsp; &nbsp; &nbsp; BackGround(0, 3);</p><p>&nbsp; &nbsp; &nbsp; &nbsp; break;//蛇打印湖蓝色</p><p>&nbsp; &nbsp; &nbsp; default:</p><p>&nbsp; &nbsp; &nbsp; &nbsp; break;</p><p>&nbsp; &nbsp; &nbsp; }</p><p>&nbsp; &nbsp; &nbsp; printf(&quot;&nbsp; &quot;);//地图中直接就是涂空格符</p><p>&nbsp; &nbsp; }</p><p>&nbsp; //接下来要显示积分//</p><p>&nbsp; gotoxy(35, 0);</p><p>&nbsp; BackGround(7, 0);//用白字黑底打印</p><p>&nbsp; printf(&quot;现在得分是:%d,请再接再厉!^_^&quot;, look[2]);</p><p>}</p><p>&nbsp;</p><p>&nbsp;</p><p>//**运动主体**//</p><p>void map(int bk[20][20], int look[4], int xy[2], int move[20][20]) {</p><p>&nbsp; //bk是地图信息,look作数据记录,xy记录坐标,move记录蛇的运动轨迹</p><p>&nbsp; int b[10], qq=0, pp=0;//b用来吸收输入,qq和pp用来随机初始化果实坐标</p><p>&nbsp; if (kbhit()) {//记录按下的是哪个方向键</p><p>&nbsp; &nbsp; b[0] = getch();//用b来记录</p><p>&nbsp; &nbsp; if (b[0] == 224)&nbsp; b[0] = getch();//如果为224表示为方向键,但是要再一次获取才行</p><p>&nbsp; &nbsp; if (b[0] == 72 &amp;&amp; look[0] != 2)</p><p>&nbsp; &nbsp; &nbsp; //如果输入的为上并且朝向不为下</p><p>&nbsp; &nbsp; &nbsp; look[0] = 1;</p><p>&nbsp; &nbsp; if (b[0] == 80 &amp;&amp; look[0] != 1)</p><p>&nbsp; &nbsp; &nbsp; look[0] = 2;</p><p>&nbsp; &nbsp; if (b[0] == 75 &amp;&amp; look[0] != 4)</p><p>&nbsp; &nbsp; &nbsp; look[0] = 3;</p><p>&nbsp; &nbsp; if (b[0] == 77 &amp;&amp; look[0] != 3)</p><p>&nbsp; &nbsp; &nbsp; look[0] = 4;</p><p>&nbsp; }</p><p>&nbsp; switch (look[0]) {</p><p>&nbsp; case 1:</p><p>&nbsp; &nbsp; //往上走</p><p>&nbsp; &nbsp; xy[1]--;</p><p>&nbsp; &nbsp; break;</p><p>&nbsp; case 2:</p><p>&nbsp; &nbsp; //往下走</p><p>&nbsp; &nbsp; xy[1]++;</p><p>&nbsp; &nbsp; break;</p><p>&nbsp; case 3:</p><p>&nbsp; &nbsp; //往左走</p><p>&nbsp; &nbsp; xy[0]--;</p><p>&nbsp; &nbsp; break;</p><p>&nbsp; case 4:</p><p>&nbsp; &nbsp; //往右走</p><p>&nbsp; &nbsp; xy[0]++;</p><p>&nbsp; &nbsp; break;</p><p>&nbsp; }</p><p>&nbsp; //接下来蛇就开始走动了//</p><p>&nbsp; move[0][0]++;//蛇的步数加一</p><p>&nbsp; move[xy[0]][xy[1]] = move[0][0];//记录当前格子中蛇的轨迹</p><p>&nbsp; gotoxy(35, 2);</p><p>&nbsp; BackGround(7, 0);</p><p>&nbsp; printf(&quot;横坐标:%d,纵坐标:%d&quot;, xy[0],xy[1]);</p><p>&nbsp; gotoxy(xy[0] * 2, xy[1]);//这里蛇头就往前移动了</p><p>&nbsp; BackGround(0, 3);//与蛇体一个颜色</p><p>&nbsp; printf(&quot;&nbsp; &quot;);</p><p>&nbsp;</p><p>&nbsp; //如果吃了果实//</p><p>&nbsp; if (bk[xy[0]][xy[1]] == 2) {</p><p>&nbsp; &nbsp; look[2]++;//分数加一</p><p>&nbsp; &nbsp; look[1]++;//长度加一</p><p>&nbsp; &nbsp; //更新分数</p><p>&nbsp; &nbsp; gotoxy(35, 0);</p><p>&nbsp; &nbsp; BackGround(7, 0);</p><p>&nbsp; &nbsp; printf(&quot;现在得分是:%d,请再接再厉!^_^&quot;, look[2]);</p><p>&nbsp; &nbsp; while (bk[pp][qq] != 0) {</p><p>&nbsp; &nbsp; &nbsp; pp = rand() % 15 + 1;</p><p>&nbsp; &nbsp; &nbsp; qq = rand() % 15 + 1;</p><p>&nbsp; &nbsp; }</p><p>&nbsp; &nbsp; bk[pp][qq] = 2;//将这个地方变为果实</p><p>&nbsp; &nbsp; gotoxy(pp * 2, qq);</p><p>&nbsp; &nbsp; BackGround(0, 2);</p><p>&nbsp; &nbsp; printf(&quot;&nbsp; &quot;);</p><p>&nbsp; }</p><p>&nbsp;</p><p>&nbsp; //如果撞了墙或者自己//</p><p>&nbsp; if (bk[xy[0]][xy[1]] == 1 || bk[xy[0]][xy[1]] == 3) {</p><p>&nbsp; &nbsp; look[3] = 1;//表示已经输了</p><p>&nbsp; &nbsp; gotoxy(6, 6);</p><p>&nbsp; &nbsp; BackGround(7, 0);</p><p>&nbsp; &nbsp; printf(&quot;你输了,最后得分:%d&quot;, look[2]);</p><p>&nbsp; }</p><p>&nbsp;</p><p>&nbsp; bk[xy[0]][xy[1]] = 3;//使这个位置变成蛇</p><p>&nbsp; //接下来要检测蛇然后刷新蛇的位置//</p><p>&nbsp; for(int i=0;i&lt;=16;i++)</p><p>&nbsp; &nbsp; for (int j = 0; j &lt;= 16; j++) {</p><p>&nbsp; &nbsp; &nbsp; if (move[i][j] == move[xy[0]][xy[1]] - look[1]){</p><p>&nbsp; &nbsp; &nbsp; &nbsp; //如果符合这个条件,则表示蛇已经移动出这个位置了</p><p>&nbsp; &nbsp; &nbsp; &nbsp; //要删除这个位置的蛇尾巴</p><p>&nbsp; &nbsp; &nbsp; &nbsp; //一次只有一个方块会符合要求吧?</p><p>&nbsp; &nbsp; &nbsp; &nbsp; bk[i][j] = 0;</p><p>&nbsp; &nbsp; &nbsp; &nbsp; gotoxy(i * 2, j);</p><p>&nbsp; &nbsp; &nbsp; &nbsp; BackGround(0, 0);</p><p>&nbsp; &nbsp; &nbsp; &nbsp; printf(&quot;&nbsp; &quot;);</p><p>&nbsp; &nbsp; &nbsp; &nbsp; break;//一次只找一个</p><p>&nbsp; &nbsp; &nbsp; }</p><p>&nbsp; &nbsp; }</p><p>&nbsp; end:;</p><p>}</p><p>void functionB(char choice){</p><p> int bk[20][20], xy[2], move[20][20], look[4];</p><p>&nbsp; xy[1] = xy[0] = 8;</p><p>&nbsp; srand((unsigned) time(NULL));//初始化随机种子</p><p>&nbsp; system(&quot;pause&quot;);</p><p>&nbsp; restart(bk, look, move);</p><p>&nbsp; while (look[3] == 0) {</p><p>&nbsp; &nbsp; Sleep(200);//休眠400ms一次</p><p>&nbsp; &nbsp; map(bk, look, xy, move);</p><p>&nbsp; }</p><p>&nbsp; system(&quot;pause&quot;);</p><p>&nbsp; printf(&quot;游戏结束,谢谢游玩!^_^&quot;);</p><p>}&nbsp;</p><p>int main(){</p><p> menu();</p><p> return 0;</p><p>}</p><p><br ></p>
    物联网205 陈腾 发表于2020年12月21日
    添加评论