mirror of
https://github.com/13hannes11/UU_la_parallel_programming_practical_assignments.git
synced 2024-09-04 00:50:58 +02:00
add possibility to print a set to a string
This commit is contained in:
@@ -1,6 +1,9 @@
|
||||
#include "Set.h"
|
||||
#include "Node.h"
|
||||
|
||||
#include <iostream>
|
||||
#include<sstream>
|
||||
|
||||
Set::Set(std::string _name){
|
||||
name = _name;
|
||||
first = Node::Dummy();
|
||||
@@ -11,3 +14,13 @@ bool Set::add(int element) { return false; }
|
||||
bool Set::rmv(int element) { return false; }
|
||||
bool Set::ctn(int element) { return false; }
|
||||
std::string Set::get_name() { return name; }
|
||||
|
||||
std::string Set::print_set(){
|
||||
Node* c = this->first->next;
|
||||
std::stringstream ss;
|
||||
while (!c->is_dummy()) {
|
||||
ss << c->get_data() << " ";
|
||||
c = c->next;
|
||||
}
|
||||
return ss.str();
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user