Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- // tính thứ.cpp : Defines the entry point for the console application.
- //
- #include "stdafx.h"
- #include <iostream>
- using namespace std;
- int main()
- {
- int thang,ngay,mon,tues,wed,thurs,satur,sun,thu;
- cout << "Nhap ngay: ";
- cin >> ngay;
- cout << "Nhap thang: ";
- cin >> thang;
- if (thang == 1 || thang == 3 || thang == 5 || thang == 7 || thang == 8 || thang == 10 || thang == 12)
- {
- if (ngay > 31 && ngay <1)
- {
- cout << "Ngay ko hop le \n";
- }
- return 1;
- }
- else if (thang == 4 || thang == 6 || thang == 9 || thang == 11)
- {
- if (ngay > 30 && ngay < 1)
- {
- cout << "Ngay khong hop le";
- return 1;
- }
- }
- else if (thang == 2)
- {
- if (ngay > 28 && ngay < 1)
- {
- cout << "Ngay khong hop le";
- return 1;
- }
- }
- else if (thang < 1 && thang > 12)
- {
- cout << "Thang ko hop le";
- return 1;
- }
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement