-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathto_test.cpp
More file actions
118 lines (105 loc) · 2.97 KB
/
to_test.cpp
File metadata and controls
118 lines (105 loc) · 2.97 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
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
#include <iostream>
using namespace std;
void registration(){
fstream myfile;
random_device rd; // Non-deterministic random number generator
mt19937 gen(rd()); // Seed the Mersenne Twister engine
// Generate random integers between 1 and 100
uniform_int_distribution<> distrib_int(1, 100000000);
long long acc_num = distrib_int(gen);
string ext = ".txt";
string ext2 = "_balance.txt";
string ext3 = "_history.txt";
string ext4 = "_info.txt";
string bank_name = "Dbank_";
string temp;
string name;
int dob_day;
string dob_month;
int dob_year;
string address;
int phone_num;
string email;
string username;
string password;
string cp;
cout << "Enter your name: ";
//cin.ignore();
getline(cin, name);
dc:
cout << "Enter the day you were born: ";
cin >> dob_day;
if(dob_day > 31 || dob_day < 1){
cout << "Invalid month!\n";
goto dc;
}
mc:
cout << "Enter the month you were born: ";
cin >> dob_month;
if(months.count(dob_month) != 1){
cout << "Invalid month. First letter is always capital.\n";
goto mc;
}
yc:
cout << "Enter the year you were born: ";
cin >> dob_year;
if(dob_year > 2025 || dob_year < 1900){
cout << "Invalid year.\n";
goto yc;
}
cout << "Enter your Home Address: ";
cin.ignore();
getline(cin, address);
cout << "Enter your Phone Number: ";
cin >> phone_num;
cout << "Enter your Email: ";
cin >> email;
uc:
cout << "Enter your username: ";
cin >> username;
while(username.size() == 0){
cout << "Username can't be empty\n";
//goto uc;
cout << "Enter your username: ";
cin >> username;
}
bool check_file = u_check(username);
while(check_file == 1){
cout << "It has been taken.\n";
//goto uc;
cout << "Enter your username: ";
cin >> username;
check_file = u_check(username);
}
pt:
cout << "Enter your password: ";
cin >> password;
cout << "Confirm your Password: ";
cin >> cp;
while(cp != password){
cout << "Password does'nt match\n";
//goto pt;
cout << "Enter your password: ";
cin >> password;
cout << "Confirm your Password: ";
cin >> cp;
}
// string temp = username;
// temp.append(ext);
string account_n = acc_correction(acc_num);
universal_file(username, account_n, password);
temp = username;
temp.append(ext)
bank_name.append(account_n);
bank_name.append(ext4);
myfile.open(bank_name, ios::out);
myfile << account_n << endl;
myfile << "Name: " << name << endl;
myfile << "DOB: " << dob_day << ", " << dob_month << ", " << dob_year << endl;
myfile << "Address: " << address << endl;
myfile << "Phone Number: " << phone_num << endl;
myfile << "Email: " << email << endl;
myfile << username << endl;
myfile << password << endl;
myfile.close();
}