Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include<iostream>
- using namespace std;
- bool es_data_valida (int x, int y, int z) {
- bool traspas;
- if ((z%100 == 0 and (z/100)%4 == 0) or (z%4 == 0 and z%100 != 0)) traspas = true;
- else traspas = false;
- if (x > 31 or y > 12 or x < 1 or y <1) return false;
- else if (y == 2 and (x > 29 or (x == 29 and not traspas))) return false;
- else if (x == 31 and (y == 2 or y == 4 or y == 6 or y == 9 or y == 11)) return false;
- else return true;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement