Skip to content

Commit 6d13313

Browse files
committed
更改类名命名方法为驼峰法
1 parent fed6035 commit 6d13313

File tree

7 files changed

+35
-36
lines changed

7 files changed

+35
-36
lines changed

class_student.hpp

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,14 @@
11
#pragma once
22

3-
class Tmp_dat
3+
class TmpDat
44
{
55
public:
66
long long Num;
77
std::string S_name;
88
double Score;
99
};
1010

11-
class student
11+
class Student
1212
{
1313
public:
1414
bool check_file(std::string);
@@ -46,17 +46,17 @@ class student
4646
void show(bool, int);
4747
bool check(int);
4848

49-
static bool by_num(Tmp_dat a, Tmp_dat b)
49+
static bool by_num(TmpDat a, TmpDat b)
5050
{
5151
return a.Num < b.Num;
5252
}
5353

54-
static bool by_name(Tmp_dat a, Tmp_dat b)
54+
static bool by_name(TmpDat a, TmpDat b)
5555
{
5656
return (a.S_name.compare(b.S_name)) < 0;
5757
}
5858

59-
static bool by_score(Tmp_dat a, Tmp_dat b)
59+
static bool by_score(TmpDat a, TmpDat b)
6060
{
6161
return (a.Score != b.Score ? a.Score > b.Score : a.Score < b.Score);
6262
}

fun_load.cpp

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -11,11 +11,11 @@ using namespace std;
1111

1212
Password ps;
1313
fstream key;
14-
My_sleep_cls Koishi;
14+
MySleepCls Koishi;
1515
map<string, string> login;
1616
map<string, string>::iterator key_it;
1717

18-
int student::welcome()
18+
int Student::welcome()
1919
{
2020
if (check_isfile_empty(KEY))
2121
{
@@ -46,7 +46,7 @@ int student::welcome()
4646
return 1;
4747
}
4848
}
49-
void student::welcome2()
49+
void Student::welcome2()
5050
{
5151
for (char *i = weltxt3; *i != '\000'; *i++)
5252
{
@@ -57,7 +57,7 @@ void student::welcome2()
5757
re_gister(true);
5858
return;
5959
}
60-
void student::re_gister(bool n_ew)
60+
void Student::re_gister(bool n_ew)
6161
{
6262
if (n_ew)
6363
{
@@ -150,7 +150,7 @@ void student::re_gister(bool n_ew)
150150
}
151151
}
152152
}
153-
void student::lo_ad()
153+
void Student::lo_ad()
154154
{
155155
if (!key_load())
156156
{
@@ -210,7 +210,7 @@ void student::lo_ad()
210210
return;
211211
}
212212

213-
bool student::key_load()
213+
bool Student::key_load()
214214
{
215215
bool r_key_load = true;
216216
key.open(KEY, ios::in);
@@ -228,7 +228,7 @@ bool student::key_load()
228228
key.close();
229229
return r_key_load;
230230
}
231-
bool student::key_save()
231+
bool Student::key_save()
232232
{
233233
bool r_key_save = true;
234234
key.open(KEY, ios::out);
@@ -249,7 +249,7 @@ bool student::key_save()
249249
key.close();
250250
return r_key_save;
251251
}
252-
bool student::check_file(string file_name)
252+
bool Student::check_file(string file_name)
253253
{
254254
fstream fs;
255255
bool r;
@@ -261,7 +261,7 @@ bool student::check_file(string file_name)
261261
fs.close();
262262
return r;
263263
}
264-
bool student::check_isfile_empty(string file_name)
264+
bool Student::check_isfile_empty(string file_name)
265265
{
266266
int n = 0;
267267
fstream fs;

fun_load.exe

652 KB
Binary file not shown.

fun_main.cpp

Lines changed: 18 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -8,11 +8,11 @@
88
using namespace std;
99

1010
fstream dat;
11-
list<Tmp_dat> sort_list_stu;
12-
list<Tmp_dat> list_student;
13-
list<Tmp_dat>::iterator it;
14-
My_sleep_cls Marisa;
15-
void student::start()
11+
list<TmpDat> sort_list_stu;
12+
list<TmpDat> list_student;
13+
list<TmpDat>::iterator it;
14+
MySleepCls Marisa;
15+
void Student::start()
1616
{
1717
while (1)
1818
{
@@ -25,7 +25,7 @@ void student::start()
2525
Marisa.my_cls();
2626
return;
2727
}
28-
bool student::init()
28+
bool Student::init()
2929
{
3030
bool r = true;
3131
do
@@ -59,21 +59,21 @@ bool student::init()
5959
r = false;
6060
break;
6161
}
62-
Tmp_dat tmp_dat;
62+
TmpDat tmp_dat;
6363
while (dat >> tmp_dat.Num >> tmp_dat.S_name >> tmp_dat.Score)
6464
sort_list_stu.push_back(tmp_dat);
6565
} while (0);
6666
dat.close();
6767
copy(sort_list_stu.begin(), sort_list_stu.end(), back_inserter(list_student));
6868
return r;
6969
}
70-
void student::cle_ar()
70+
void Student::cle_ar()
7171
{
7272
sort_list_stu.clear();
7373
list_student.clear();
7474
return;
7575
}
76-
bool student::save()
76+
bool Student::save()
7777
{
7878
bool r = true;
7979
dat.open(dat_name, ios::out);
@@ -96,7 +96,7 @@ bool student::save()
9696
dat.close();
9797
return r;
9898
}
99-
int student::menu()
99+
int Student::menu()
100100
{
101101
int n;
102102
Marisa.my_cls();
@@ -148,7 +148,7 @@ int student::menu()
148148
return n;
149149
}
150150

151-
int student::look_s()
151+
int Student::look_s()
152152
{
153153
Marisa.my_cls();
154154
cout << "\t\t\t请选择排序方法:\n";
@@ -179,7 +179,7 @@ int student::look_s()
179179
}
180180
return n;
181181
}
182-
void student::show(bool r, int n)
182+
void Student::show(bool r, int n)
183183
{
184184
if (n)
185185
{
@@ -209,10 +209,10 @@ void student::show(bool r, int n)
209209
return;
210210
}
211211

212-
int student::add_s()
212+
int Student::add_s()
213213
{
214214
int n = 1;
215-
Tmp_dat tmp_dat;
215+
TmpDat tmp_dat;
216216
while (1)
217217
{
218218
cout << "请输入学号:";
@@ -246,7 +246,7 @@ int student::add_s()
246246
return n;
247247
}
248248

249-
bool student::check(int number)
249+
bool Student::check(int number)
250250
{
251251
bool r = false;
252252
it = list_student.begin();
@@ -262,7 +262,7 @@ bool student::check(int number)
262262
return r;
263263
}
264264

265-
int student::modify_s()
265+
int Student::modify_s()
266266
{
267267

268268
int n = 1;
@@ -320,7 +320,7 @@ int student::modify_s()
320320
} while (0);
321321
return n;
322322
}
323-
int student::del_s()
323+
int Student::del_s()
324324
{
325325
int n = 1;
326326
int r = 0;
@@ -368,7 +368,7 @@ int student::del_s()
368368
return n;
369369
}
370370

371-
int student::count_s()
371+
int Student::count_s()
372372
{
373373
Marisa.my_cls();
374374
cout << "\t\t\t请选择要统计的信息:\n";

main.cpp

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,14 @@
11
#include <iostream>
22
#include <fstream>
33
#include "class_student.hpp"
4-
// 存在问题:多次引用sleep_cls.h会报错
5-
// 登录界面支持linux,主界面引不了sleep_cls.h,只支持win32
64

75
// 支持多用户登录,修改账号密码
86
// V1.0.1
7+
98
using namespace std;
109
int main()
1110
{
12-
student st;
11+
Student st;
1312
while (1)
1413
{
1514
if (st.check_file(st.KEY))

main.exe

651 KB
Binary file not shown.

sleep_cls.hpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
#else
55
#include <unistd.h>
66
#endif
7-
class My_sleep_cls
7+
class MySleepCls
88
{
99
public:
1010
void my_sleep(unsigned int ms)

0 commit comments

Comments
 (0)