English Deutsch Français Italiano Español Português 繁體中文 Bahasa Indonesia Tiếng Việt ภาษาไทย
All categories

#ifndef MYSET_H
#define MYSET_H

#include
#include
#include
#include

using namespace std;

#define MAX_SET_SIZE 100 // Default maximum set size
template // DEFINE element_type


class MySet {

private:
element_type *Container;

int setSize;
string setName;
int maxSetSize;
public:

MySet();
MySet(string label);
MySet(string label, int maxSize);
MySet(int maxSize);
MySet(const MySet &secondSet);
~MySet();


int cardinality() {return setSize;}
bool inSet(element_type element);

bool isFull();
element_type getElement(int index);

void setLabel(string label); // sets the name of the set


MySet operator - (MySet a, element_type b);
MySet operator - (MySet a, MySet b);
MySet operator += (MySet a, element_type b);
MySet operator += (MySet a, MySet b);
MySet operator -= (MySet a, element_type b);
MySet operator = (MySet a, element_type b);


};

2007-02-21 11:58:58 · 4 answers · asked by Anonymous in Science & Mathematics Engineering

#ifndef MYSET_H
#define MYSET_H

#include
#include
#include
#include

using namespace std;

#define MAX_SET_SIZE 100 // Default maximum set size
template // DEFINE element_type


class MySet {

private:
element_type *Container;

int setSize;
string setName;
int maxSetSize;
public:

MySet();
MySet(string label);
MySet(string label, int maxSize);
MySet(int maxSize);
MySet(const MySet &secondSet);
~MySet();


int cardinality() {return setSize;}
bool inSet(element_type element);

bool isFull();
element_type getElement(int index);

void setLabel(string label); // sets the name of the set


MySet operator - (MySet a, element_type b);
MySet operator - (MySet a, MySet b);
MySet operator += (MySet a, element_type b);
MySet operator += (MySet a, MySet b);
MySet operator -= (MySet a, element_type b);
MySet operator = (MySet a, element_type b);


};

#endif

2007-02-21 12:00:18 · update #1

forgot to include #endif, so just refer to the second details posting...

2007-02-21 12:01:46 · update #2

I don't know how to implement the constructors for one...

2007-02-21 12:03:47 · update #3

I'm sorry I'm such a dumb f***... I used to be bad into the habit of procrastinating... It's still a problem, but I'm getting better. You're right... I'm a f***ing loser and I should go to Hell for procrastinating on this.

If you had bothered to read the note above this one, I think you would know what the problem was, assuming it would have mattered.

I'm not cut out for this crap... I failed Calculus once, and I haven't done too well in any of the classes that will count towards my major.

I e-mailed my prof. early today and he still hasn't gotten back with me. I have exhausted every resource I've got.

I'm behind in all my other classes too...

If you would like to criticise me, make it constructive criticism... PLEASE!

2007-02-21 14:57:41 · update #4

4 answers

Well, if you DO get a chance to actually work on this homework, then read on.
.
Constructor(s) initializes all the variables. Ex:

MySet()
{
setSize = 0
maxSetSize = MAX_SET_SIZE
...
}

Now, if the constructor has parameters then you initialize the variables to the parameters if possible

Ex:

MySet(int maxSize)
{
...
maxSetSize = maxSize
..
}

~MySet() is a destructor, it's for deleting pointers if you plan to use pointers.


Functions:
In order to add & remove an element or a set, the MySet operators are these functions. Browse around for "overloading operators" & "pointer operation" that should be able to help you define these functions. Remember, since this is a "set", it does NOT contain any repeated element, also your SET is a pointer.

The rest of the functions are just returning values and search. I hope you learn something out of this.

2007-02-21 12:01:38 · answer #1 · answered by yungr01 3 · 0 0

The drug is a Mexican-grown hallucinogen called Salvia Divinorum, also known as Salvia, Diviner's Sage or Magic Mint.

2016-05-24 05:44:33 · answer #2 · answered by ? 4 · 0 0

I'm betting it will be next week before anyone figures out what the question is. Waiting until the night before your assignment is due to ask for help on Yahoo is a bad plan. You deserve the grade you get.

2007-02-21 12:37:58 · answer #3 · answered by STEVEN F 7 · 0 1

So, whats the question?

2007-02-21 12:02:52 · answer #4 · answered by Embrisa 2 · 0 0

fedest.com, questions and answers