-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathUsers.cpp
More file actions
56 lines (48 loc) · 1.68 KB
/
Copy pathUsers.cpp
File metadata and controls
56 lines (48 loc) · 1.68 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
#include "Users.hpp"
#include <iostream>
#include <vector>
#include <algorithm>
#include <string>
#include <sstream>
#include <fstream>
using namespace std;
Users::Users(int I, string N, string P, string M, vector<string> FA, vector<string> FG, vector<string> WR, vector<string> CR, vector<string> R){
id = I;
name = N;
place_of_birth = P;
member_since = M;
favorite_authors = FA;
favorite_genres = FG;
want_to_read = WR;
currently_reading = CR;
read = R;
}
int Users::get_id() { return id; }
vector<string> Users::get_want_to_read(){ return want_to_read; }
vector<string> Users::get_currently_reading(){ return currently_reading; }
vector<string> Users::get_read(){ return read; }
vector<string> Users::get_favorite_authors() { return favorite_authors; }
vector<string> Users::get_favorite_genres() { return favorite_genres; }
void Users::print_user_info_one()
{
ostringstream os;
os << "id: " << id << endl;
os << "Name: " << name << endl;
os << "Place of Birth: " << place_of_birth << endl;
os << "Member Since: " << member_since << endl;
os << "Favorite Genres: ";
sort(favorite_genres.begin(), favorite_genres.end());
for (int i = 0; i < favorite_genres.size()-1; ++i)
os << favorite_genres[i] << ", ";
os << favorite_genres[favorite_genres.size()-1];
os << endl;
cout << os.str();
}
void Users::print_user_info_two()
{
ostringstream os;
os << "Number of Books in Read Shelf: " << read.size() << endl;
os << "Number of Books Want to Read Shelf: " << want_to_read.size() << endl;
os << "Number of Books in Currently Reading Shelf: " << currently_reading.size() << endl;
cout << os.str();
}