-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathprofile.cpp
More file actions
34 lines (24 loc) · 730 Bytes
/
Copy pathprofile.cpp
File metadata and controls
34 lines (24 loc) · 730 Bytes
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
#include "profile.hpp"
#include <iostream>
//contructor definiton
Profile::Profile(std::string new_name, int new_age, std::string new_city, std::string new_country, std::string new_pronouns){
name = new_name;
age = new_age;
city= new_city;
country = new_country;
pronouns = new_pronouns;
}
//destructor definiton
std::string Profile::view_profile(){
std::string bio = "Name: " + name;
bio += "\nAge: " + std::to_string(age);
bio += "\nPronouns: " + pronouns;
std::string hobby_string = "Hobbies:\n ";
for (std::string hobby : hobbies){
hobby_string += " - " + hobby + "\n";
}
return bio +"\n"+ hobby_string;
}
void Profile::add_hobby(std::string new_hobby){
hobbies.push_back(new_hobby);
}