Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

How to use c # to realize the problem of fishing and drying the net

2025-04-07 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Internet Technology >

Share

Shulou(Shulou.com)06/01 Report--

This article mainly introduces "how to use c # to realize the problem of fishing and drying the net". In the daily operation, I believe that many people have doubts about how to use c # to realize the problem of fishing and drying the net. The editor consulted all kinds of materials and sorted out a simple and useful method of operation. I hope it will be helpful for everyone to answer the question of "how to use c # to realize the problem of fishing and drying the net." Next, please follow the editor to study!

If a fisherman starts fishing every three days and drying the net every two days since January 1, 2011, it is programmed to output whether the fisherman is fishing or drying the net on any day after January 1, 2011.

C code:

/ * on the sixth day, the problem of fishing and basking in the net * / # include # include int leap (int a) {if ((a% 4 = = 0) & & (a% 100! = 0) | | (a% 400 = = 0) return 1 posielsereturn 0;} int number (int year,int month,int day) {int result = 0PersoniJing KMIT average_year [12] = {31pc28, 31pr, 31pr, 31pr, 31pr, 31pr, 31pr, 31pr, 31pr, 31g, 330j, 330g, 31g, 330g, 330g / / Leap year if (leap (year) = = 1) {for (I = 0 position I)

< month - 1;i++) result += leap_year[i]; result += day; }else{for(i = 0;i < month - 1;i++) result += average_year[i]; result += day; }for(j = 2011;j < year;j++)if(leap(year) == 1) result += 366;elseresult += 365;return result;}void main(void){int year,month,day,days;printf("请输入要查询的年月日,例如2011-10-10\n"); scanf("%d-%d-%d",&year,&month,&day); days = number(year,month,day);if((days % 5) < 4 && (days % 5) >

0) printf ("% d year% d month% d day: fisherman fishing\ n", year,month,day); elseprintf ("% d year% d month% d day: fisherman drying net\ n", year,month,day); system ("pause");}

The results show that:

At this point, the study on "how to use c # to realize the problem of fishing and drying the net" is over. I hope to be able to solve your doubts. The collocation of theory and practice can better help you learn, go and try it! If you want to continue to learn more related knowledge, please continue to follow the website, the editor will continue to work hard to bring you more practical articles!

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Internet Technology

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report