-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathutils.cpp
More file actions
48 lines (48 loc) · 1.14 KB
/
utils.cpp
File metadata and controls
48 lines (48 loc) · 1.14 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
//
// Created by dee l on 14/03/2026.
//
#include "User.h"
#include "utils.h"
#include <iostream>
#include <fstream>
using namespace std;
bool abdallah::identifiantUserExist(int ident) {
ifstream user_file("Utilisateur.bin" ,ios::in |ios::binary);
User un_user;
while (user_file.read((char*)&un_user, sizeof(User))) {
if (un_user.getid() == ident) {
return identifiantUserExist(ident);
}
}
return true;
}
bool estbissextile(int ann) {
if (ann %4 == 0) {
if (ann %100==0 && ann %400==0) {
return true;
}
else {
return false;
}
return true;
}
return false;
}
bool dateValide(int jj, int mm, int an) {
if (mm ==1 || mm == 3 || mm==5 || mm ==7 || mm == 8 || mm == 10 || mm ==12 ) {
if (jj<=31 && jj>=1)
{return true;}
}
else if (mm == 4 || mm == 6 || mm==9 || mm==11) {
if (jj<=30 && jj>=1){return true;}
}
else if (mm == 2) {
if (estbissextile(an)) {
if (jj<=29 && jj>1){return true;}
}
else {
if (jj<=28 && jj>1){return true;}
}
}
return false;
}