Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 1 addition & 2 deletions include/Database.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,7 @@ class Database {
void loadFromFile(std::string filename);
std::vector<std::string> changeString(std::string line);
void createPersonIn(std::vector<std::string> data);


void modifyAddress(const unsigned long int pesel, std::string newAddress);
private:
PeopleBase peopleBase_;
};
1 change: 0 additions & 1 deletion include/Student.hpp
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
#pragma once
#include "../include/Person.hpp"
#include <vector>

Expand Down
6 changes: 5 additions & 1 deletion src/Database.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,11 @@ void Database::sortByPesel()

void Database::sortBySalary()
{

}
void Database::modifyAddress(const int pesel, const std::string newAddress)
{
auto person = findByPesel(pesel);
person->setAddress(newAddress);
}

void Database::saveToFile(std::string filename) const
Expand Down
4 changes: 4 additions & 0 deletions src/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,10 @@ int main()
std::cout<<"Find By Pesel";
Person* ptr= db.findByPesel(10987654321);
std::cout << ptr->getPersonDetails();

db.modifyAddress(87112345697, "Grabiszynska 9, 53-501 Wrocław");
db.showBase();

delete john;
delete ben;
return 0;
Expand Down