-
Notifications
You must be signed in to change notification settings - Fork 6
/
Copy pathbase.h
85 lines (79 loc) · 1.74 KB
/
base.h
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
#ifndef BOOK_H
#define BOOK_H
#include<string>
#include<map>
#include<iostream>
#include<vector>
using namespace std;
class Book {
public:
Book() {
cnt = 0;
sum = 0;
aveRank=0;
}
void deletebook();
void addbook();
void rechangebook(string s1, string s2);
string title, author, publisher; //标题、作者、出版社
string year; //时间
string urlS, urlM, urlL; //三个信息
double aveRank, sum; //平均分、总分
int cnt; //评论数量
//part3新增
vector<string> comment;
vector<string> commentauthor;
string id;
map<string, int> userRanked;
void show() {
// if(title!=" "&&year!=" ")
cout << title << " (" << year << ")" << endl;
// else
// cout<<id<<endl;
// if(author!=" ")
cout << author << endl;
// if(aveRank!=0)
cout << "Average Rating: " << aveRank << endl;
}
map<string, int> usersRead; //被哪些用户看过及评分
};
#endif // BOOK_H
#ifndef USER_H
#define USER_H
#include<string>
#include<map>
using namespace std;
class User {
public:
User() {
sum = 0;
cnt = 0;
password="iamauser";
}
void deleteuser();
void addusers();
void rechangeuser(string s1, string s2);
string town, city, country;
int age;
int cnt; //评论数量
string himself;
string password;
double aveRank, sum;
map<string, int> booksRead; //此用户看过的书名及评分
//part3新增
string isbn;
Book findByName(string ti);
void rank(int rank, string str);
// string id;
void get_init_reco();
double get_sim(User const& u);
map<string,User> sim_user;
void add_comment(Book&, string comm);
//结束
void getrecommendation();
void show(){
cout<<himself<<";"<<town<<","<<city<<","<<country<<";"<<age<<endl;
}
};
#endif // USER_H
//深复制问题