Implementing a set class of data

Assignment Help Basic Computer Science
Reference no: EM13829590

Problem:

Implement the following Set class. A set is a collection of items with no duplicates. The following class implements a set of integers.

#ifndef SET_H 
#define SET_H 
#include <iostream> 
#include <vector> 
using namespace std; 
class Set 

// friend operator functions 
friend ostream &operator<<(ostream & out, const Set & s); 
friend istream &operator>>(istream & in, Set & s); 
public: 
// Constructors 
Set(); // default constructor 
Set(const Set & s); // copy constructor 
// destructor 
~Set(); 
// operator functions 
Set operator||(Set & s); // union of the set with the set s 
Set operator&&(Set & s); // intersection of the set with the set s 
const Set& operator=(const Set & s); // assignment 
bool operator==(const Set & s); // equality 
int& operator[](int index); // returns modifiable lvalue 
int operator[](int index) const; // returns rvalue 
// Set membership functions 
bool member(int m); // The integer m is a member 
void add(int m); // add the integer m to the set 
void remove(int m); // remove the integer m from the set 
private: 
vector<int> _s; 
}; 
#endif

The member functions must be written in a file Set.cpp. You are required to provide a driver program for the above class as well.

Additional Information:

This question is from Computer Science as well as it discusses about implementing a set class of data with no duplicates using C++. Apart from this, a driver program for the class.

Reference no: EM13829590

Questions Cloud

Bonds make annual payments-what is the current bond price : Bey Co. issued 20-year, $1,000 bonds at a coupon rate of 7 percent. The bonds make annual payments. If the YTM on these bonds is 5 percent, what is the current bond price?
Discuss the importance of securing advance directives : As a health administrator, discuss the importance of securing advance directives at the time of inpatient registration or emergency care. As a health administrator, discuss how advance directives would have facilitated care in the Quinlan and Shiavo ..
Describe strategy to identify the best and worst selling : Given the sales data shown on accompanying worksheet, describe a strategy to identify the best and worst selling days during the period (i.e., Monday through Sunday), the average sales by day, and to sort total monthly sales from lowest to highest.
Discuss the importance of securing advance directives : As a health administrator, discuss the importance of securing advance directives at the time of inpatient registration or emergency care. As a health administrator, discuss how advance directives would have facilitated care in the Quinlan and Shiavo ..
Implementing a set class of data : The member functions must be written in a file Set.cpp. You are required to provide a driver program for the above class as well.
Increased the importance of personal financial planning : There are at least three major areas that affect financial decisions. Life situations such as income, age, household size, and health. What are some of the social and economic factors that have increased the importance of personal financial planning ..
Process of preparing annual budget : Arter Corporation is in the process of preparing its annual budget. The following beginning and ending inventory levels are planned for the year. How much of the raw material should the company purchase during the year? Assume that company plans to s..
Officers refuse direct orders that violate human rights : 1.1 you think that individuals in a war have personal accountability for their violations of fundamental human rights? 1.2 Can individual soldiers or intelligence officers refuse direct orders that violate human rights? Should soldiers be held person..
Estimating the values of the fields : Suppose that an Ethernet packet is given and its hexadecimal dump is shown as below, where the Ethernet preamble and the Ethernet checksum trailer have been removed. Manually decode this Ethernet packet, and determine the values of the fields.

Reviews

Write a Review

Basic Computer Science Questions & Answers

  Identifies the cost of computer

identifies the cost of computer components to configure a computer system (including all peripheral devices where needed) for use in one of the following four situations:

  Input devices

Compare how the gestures data is generated and represented for interpretation in each of the following input devices. In your comparison, consider the data formats (radio waves, electrical signal, sound, etc.), device drivers, operating systems suppo..

  Cores on computer systems

Assignment : Cores on Computer Systems:  Differentiate between multiprocessor systems and many-core systems in terms of power efficiency, cost benefit analysis, instructions processing efficiency, and packaging form factors.

  Prepare an annual budget in an excel spreadsheet

Prepare working solutions in Excel that will manage the annual budget

  Write a research paper in relation to a software design

Research paper in relation to a Software Design related topic

  Describe the forest, domain, ou, and trust configuration

Describe the forest, domain, OU, and trust configuration for Bluesky. Include a chart or diagram of the current configuration. Currently Bluesky has a single domain and default OU structure.

  Construct a truth table for the boolean expression

Construct a truth table for the Boolean expressions ABC + A'B'C' ABC + AB'C' + A'B'C' A(BC' + B'C)

  Evaluate the cost of materials

Evaluate the cost of materials

  The marie simulator

Depending on how comfortable you are with using the MARIE simulator after reading

  What is the main advantage of using master pages

What is the main advantage of using master pages. Explain the purpose and advantage of using styles.

  Describe the three fundamental models of distributed systems

Explain the two approaches to packet delivery by the network layer in Distributed Systems. Describe the three fundamental models of Distributed Systems

  Distinguish between caching and buffering

Distinguish between caching and buffering The failure model defines the ways in which failure may occur in order to provide an understanding of the effects of failure. Give one type of failure with a brief description of the failure

Free Assignment Quote

Assured A++ Grade

Get guaranteed satisfaction & time on delivery in every assignment order you paid with us! We ensure premium quality solution document along with free turntin report!

All rights reserved! Copyrights ©2019-2020 ExpertsMind IT Educational Pvt Ltd