can someone help me with these compiler errors? im not sure how to fix them.
intset.cpp:16: error: prototype for âIntegerSet::IntegerSet(int*)â does not matc
intset.h:6: error: candidates are: IntegerSet::IntegerSet(const IntegerSet&)
intset.h:9: error: IntegerSet::IntegerSet(int)
intset.cpp:7: error: IntegerSet::IntegerSet()
main.cpp: In function âint main()â:
main.cpp:36: error: invalid conversion from âint*â to âintâ
main.cpp:36: error: initializing argument 1 of âIntegerSet::IntegerSet(int)â
below are the files
//IntegerSet class definition
#include <iostream>
using namespace std;
class IntegerSet
{
public:
IntegerSet();//default constructor initializes all elements to zero
IntegerSet(int);//constructor with argument
IntegerSet unionOfSets(IntegerSet);//combines the sets
IntegerSet intersectionOfSets(IntegerSet);//gets integers that are common
void insertElement(int);//adds element to the array by changing it to one
void deleteElement(int);//deletes element from array by changing it to zero
int askUser();//asks user what element they want to enter
void printSet();//prints the set
bool isEqualTo(IntegerSet);// tests if setA is equal to setB
private:
int set[101];// array as private data
};
//IntegerSet member-function definitions.
#include <iostream>
using namespace std;
#include "intset.h"
IntegerSet::IntegerSet()//default constructor initializes all elements to zero
{
for ( int num = 0; num < 101; num++)
{
set[num] = 0;
}
}
IntegerSet::IntegerSet(int a[])//constructor with argument
{
for ( int num = 0; num < 7; num++)
{
if ( a[num] == 1)
{
a[num] = 1;
} else if ( a[num] == 0)
{
a[num] = 0;
}
}
}
IntegerSet IntegerSet::unionOfSets(IntegerSet b)//combines the sets
{
IntegerSet c;
for ( int i = 0; i < 101; i++ )
{
if ( set[i] || b.set[i] )
c.set[i] = 1;
}
return( c );
}
IntegerSet IntegerSet::intersectionOfSets(IntegerSet a)//gets integers that are common
{
IntegerSet d;
for ( int i = 0; i < 101; i++ )
{
if ( set[i] && a.set[i] )
d.set[i] = 1;
}
return( d );
}
void IntegerSet::insertElement(int num)//adds element to the array by changing it to one
{
set[num] = 1;
}
void IntegerSet::deleteElement(int num)//deletes element from array by changing it to zero
{
set[num] = 0;
}
int IntegerSet::askUser()//asks user what element they want to enter
{
int element;
char d;
cout << "What would you like to do add (a) or delete (d) a number from the set?";
cin >> d;
if ( d == 'a')
{
do{
cout << "Which number(0-100) would like to add to the set? Enter -1 to stop:";
cin >> element;
insertElement(element);
}while ( element != -1);
} else if ( d == 'd')
{
do{
cout << "Which number(0-100) would like to delete from the set? Enter -1 to stop:";
cin >> element;
deleteElement(element);
} while (element != 1);
}
return element;
}
void IntegerSet::printSet()//prints the set
{
cout << " The numbers in the set are: ";
for ( int i = 0; i < 101; i++ )
{
if ( set[i] == 1 )
cout << i << ' ';
}
}
bool IntegerSet::isEqualTo(IntegerSet b)// tests if setA is equal to setB
{
bool restat = false;
for (int i; i = 0; i++)
{
if ( set[i] == b.set[i] )
restat = true;
}
return restat;
}
// main program
#include <iostream>
using namespace std;
#include "intset.h"
int main()
{
IntegerSet setA;
cout << "For Set A\n";
setA.askUser();
setA.printSet();
IntegerSet setB;
cout << "\nFor Set B\n";
setB.askUser();
setB.printSet();
IntegerSet setC = setA.unionOfSets(setB);
cout << "\nFor Union Set\n";
setC.printSet();
IntegerSet setD = setB.intersectionOfSets(setA);
cout << "\nFor Intersection Set\n";
setD.printSet();
if (setA.isEqualTo(setB))
{
cout << "\nThey are equal\n";
}
else
{
cout << "\nThey are not equal\n";
}
int a[] = {0,1,0,1,0,1,1};
IntegerSet setE(a);
return 0;
}