Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- #include <conio.h>
- #include <math.h>
- using namespace std;
- int main()
- {
- int dd,mm,yy,ddmax, i, k;
- cout<<"Chon nam : ";
- cin>>yy;
- cout<<"Chon thang : ";
- cin>>mm;
- if ((yy < 0) || (mm > 12) || (dd < 0) || (dd > 31) || (mm < 0))
- cout<<"KHONG HOP LE";
- else
- {
- switch (mm)
- {
- case 1:
- case 3:
- case 5:
- case 7:
- case 8:
- case 10:
- case 12:
- ddmax=31;
- {
- cout<<"Nhap vao ngay bat ki : ";
- cin>>i;
- if (i < ddmax )
- {
- k=i+1;
- cout<<"ngay tiep theo la : "<< k;
- }
- else
- cout<<"LOI" ;
- }
- break;
- case 2:
- if ((yy % 4 == 0) && (yy % 100 != 0) || (yy % 400 == 0))
- ddmax=29;
- else
- ddmax=28;
- {
- cout<<"Nhap vao ngay bat ki : ";
- cin>>i;
- if (i < ddmax )
- {
- k=i+1;
- cout<<"ngay tiep theo la : "<< k;
- }
- else
- {
- cout<<"LOI" ;
- }
- }
- case 4:
- case 6:
- case 9:
- case 11:
- ddmax=30;
- break;
- {
- cout<<"Nhap vao ngay bat ki : ";
- cin>>i;
- if (i < ddmax )
- {
- k=i+1;
- cout<<"ngay tiep theo la : "<< k;
- }
- else
- {
- if (i == ddmax)
- cout<<"Ngay tiep theo cua thang moi roi!!!";
- }
- {
- cout<<"LOI" ;
- }
- }
- default:
- {
- cout<<"KHONG HOP LE";
- }
- }
- }
- getch();
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement