Advertisement
Guest User

Untitled

a guest
Jan 21st, 2018
66
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.86 KB | None | 0 0
  1. // tính thứ.cpp : Defines the entry point for the console application.
  2. //
  3.  
  4. #include "stdafx.h"
  5. #include <iostream>
  6.  
  7. using namespace std;
  8.  
  9. int main()
  10. {
  11. int thang,ngay,mon,tues,wed,thurs,satur,sun,thu;
  12.  
  13. cout << "Nhap ngay: ";
  14. cin >> ngay;
  15. cout << "Nhap thang: ";
  16. cin >> thang;
  17.  
  18. if (thang == 1 || thang == 3 || thang == 5 || thang == 7 || thang == 8 || thang == 10 || thang == 12)
  19. {
  20. if (ngay > 31 && ngay <1)
  21. {
  22. cout << "Ngay ko hop le \n";
  23. }
  24. return 1;
  25. }
  26. else if (thang == 4 || thang == 6 || thang == 9 || thang == 11)
  27. {
  28. if (ngay > 30 && ngay < 1)
  29. {
  30. cout << "Ngay khong hop le";
  31. return 1;
  32. }
  33. }
  34. else if (thang == 2)
  35. {
  36. if (ngay > 28 && ngay < 1)
  37. {
  38. cout << "Ngay khong hop le";
  39. return 1;
  40. }
  41. }
  42. else if (thang < 1 && thang > 12)
  43. {
  44. cout << "Thang ko hop le";
  45. return 1;
  46. }
  47. return 0;
  48. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement