-
October 22nd, 2015, 06:33 PM
#1
two threads with shared memory
I am very stuck and tired of reading and searching. I am not longer sure what I am doing, I have deleted and waited a lot, but this is the last i have written, where i haven't even started on the treads.
I am trying to program a program i c++. First i need to implement animals from a figure, then i need to create a thread that create new objects and fills it with data as weight, length, where it was found,etc. this will be saved in a data-structure, example a vector in the shared memory. Last i need to create a thread that is able to see that data that is registered about the animals.
Code:
#include <iostream>
#include <vector>
#include <thread>
#include <string>
using namespace std;
int main()
{
class rovdyr
{
public:
rovdyr();
rovdyr(const rovdyr& r);
virtual ~rovdyr();
void setArt (const string& a);
string getArt() const;
void setFinding (const string& f);
string getFinding() const;
void setWeight (const double& w);
string getWeight() const;
void setAge (const double& g);
string getAge() const;
virtual void write();
protected:
string Art;
string Finding;
double Weight;
double Age;
};
class landrovdyr : public rovdyr
{
};
class seler : public rovdyr
{
};
class hunder : public landrovdyr
{
};
class bjørner : public landrovdyr
{
};
class katter : public landrovdyr
{
};
class øreseler : public seler
{
};
class hvalrosser : public seler
{
};
class selen : public seler
{
};
class dingo : public hunder
{
};
class ulv : public hunder
{
};
class brunbjørn : public bjørner
{
};
class grizzlybjørn : public bjørner
{
};
class kodabjørn : public bjørner
{
};
class løve : public katter
{
};
class tiger : public katter
{
};
class gerpard : public katter
{
};
class sjøløve : public øreseler
{
};
class sjøbjørn : public øreseler
{
};
class hvalross : public hvalrosser
{
};
class østlighvalross : public hvalrosser
{
};
class kobbe : public seler
{
};
class havert : public seler
{
};
class klappmyss : public seler
{
};
Tags for this Thread
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|