||
ToHtm1.0.2 (2011-08-17)
========================================================================================================================
增加:
+ 初步添加语法高亮
修正:
* 显示细节修正
语法高亮只做到部分支持,而且有很多错误,打开某些文件时可能会
出现死循环的问题,不知道是什么原因造成的
显示效果示例:
Powered by ToHtm 1.0.2 |
1. 2. 3. 4. 5. 6. 7. 8. 9. 10. 11. 12. 13. 14. 15. 16. 17. 18. 19. 20. 21. 22. 23. 24. 25. 26. 27. 28. 29. 30. 31. 32. 33. 34. 35. 36. 37. 38. 39. 40. 41. 42. 43. 44. 45. 46. 47. 48. 49. 50. 51. 52. 53. 54. 55. 56. 57. 58. 59. 60. 61. 62. 63. 64. 65. 66. 67. 68. 69. 70. 71. 72. 73. 74. 75. 76. 77. 78. 79. 80. 81. 82. 83. 84. 85. 86. 87. 88. 89. 90. 91. 92. 93. 94. 95. 96. 97. 98. | #include<iostream> using namespace std; struct day { int year; int month; int days; int caculate() { int m=0; if(year%4==0&&(year%100!=0||year%400==0)&&month>2) m=m+1; switch (month) { case 12:m=m+30; case 11:m=m+31; case 10:m=m+30; case 9:m=m+31; case 8:m=m+31; case 7:m=m+30; case 6:m=m+31; case 5:m=m+30; case 4:m=m+31; case 3:m=m+28; case 2:m=m+31; case 1:m=m+0; } m=m+days; return m; } int judge(int year,int month,int days) { switch (month) { case 1: case 3: case 5: case 7: case 8: case 10: case 12: if(days<1||days>31) { return 0; break; } case 4: case 6: case 9: case 11: if(days<1||days>30) { return 0; break; } case 2: if(year%4==0&&(year%100!=0||year%400==0)) if(days<1||days>29) { return 0; break; } else ; else if(days<1||days>28) { return 0; break; } } } }; int main() { day one; cout<<"please enter:year month days"<<endl; cin>>one.year>>one.month>>one.days; while(one.year) { while(one.judge(one.year,one.month,one.days)==0) { cout<<"输入有误,请重新输入:(年份为0时结束)"<<endl; cout<<"please enter:year month days"<<endl; cin>>one.year>>one.month>>one.days; } if(one.year) cout<<"这是这年的第"<<one.caculate()<<"天"<<endl; } /* while(judge(one.year,one.month,one.days)) { cout<<"这是这年的第"<<ONE.CACULATE()<<"天"<>one.year>>one.month>>one.days; }*/</ONE.CACULATE()<<"天"< return 0; } |
ToHtm Aug.17,2011 |
联系我们|手机版|欧卡2中国 ( 湘ICP备11020288号-1 )
GMT+8, 2024-5-19 08:26 , Processed in 0.019237 second(s), 7 queries , Redis On.
Powered by Discuz! X3.4
Copyright © 2001-2023, Tencent Cloud.