Advertisement
Guest User

Untitled

a guest
Feb 27th, 2017
136
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.02 KB | None | 0 0
  1. #include <iostream>
  2.  
  3. using namespace std;
  4.  
  5. int main()
  6. {
  7. int bd, bm, d, m, y, days = 0;
  8. cin >> bd >> bm >> d >> m >> y;
  9. while(!(bd == d && bm == m))
  10. {
  11. d++; days++;
  12. int feb = 0;
  13. if ((y % 400 == 0) && ((y % 4 == 0) && (y % 100 != 0))) feb++;
  14. int k;
  15. switch (m)
  16. {
  17. case 1:
  18. {
  19. k = 31;
  20. break;
  21. }
  22. case 2:
  23. {
  24. if ((y % 400 == 0) && ((y % 4 == 0) && (y % 100 != 0)))
  25. {
  26. k = 29;
  27. } else
  28. k = 28;
  29. break;
  30. case 3:
  31. {
  32. k = 31;
  33. break;
  34. }
  35. case 4:
  36. {
  37. k = 30;
  38. break;
  39. }
  40. case 5:
  41. {
  42. k = 31;
  43. break;
  44. }
  45. case 6:
  46. {
  47. k = 30;
  48. break;
  49. }
  50. case 7:
  51. {
  52. k = 31;
  53. break;
  54. }
  55. case 8:
  56. {
  57. k = 31;
  58. break;
  59. }
  60. case 9:
  61. {
  62. k = 30;
  63. break;
  64. }
  65. case 10:
  66. {
  67. k = 31;
  68. break;
  69. }
  70. case 11:
  71. {
  72. k = 30;
  73. break;
  74. }
  75. case 12:
  76. {
  77. k = 31;
  78. break;
  79. }
  80. }
  81. if (d > k)
  82. {
  83. d = 1; m++;
  84. }
  85. if (m > 12)
  86. {
  87. m = 1; y++;
  88. }
  89. }
  90. cout << days;
  91. return 0;
  92. }
  93. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement