Hi, Can someone please tell me how to fix this code? I can't continue till it is figured out. Thank you.
Severity and Description Path Resource Location Creation Time Id
candidate is: bool CompTree::isInternal(CompTree::Position&) Driver2 compTree.h line 17 1208892430959 2012
candidate is: bool CompTree::isExternal(CompTree::Position&) Driver2 compTree.h line 18 1208892430959 2014
candidate is: void CompTree::swap(CompTree::Position&, CompTree::Position&) Driver2 compTree.h line 20 1208892430959 2017
expected `;' before '<' token Driver2 compTree.h line 24 1208892430958 2002
ISO C++ forbids declaration of `vector' with no type Driver2 compTree.h line 24 1208892430958 2001
`v' undeclared (first use this function) Driver2 compTree.h line 29 1208892430958 2004
invalid member function declaration Driver2 compTree.h line 30 1208892430958 2003
`Position' does not name a type Driver2 compTree.cpp line 17 1208892430959 2005
`Position' does not name a type Driver2 compTree.cpp line 21 1208892430959 2006
`Position' does not name a type Driver2 compTree.cpp line 25 1208892430959 2007
`Position' does not name a type Driver2 compTree.cpp line 29 1208892430959 2008
`Position' does not name a type Driver2 compTree.cpp line 33 1208892430959 2009
`Position' does not name a type Driver2 compTree.cpp line 37 1208892430959 2010
prototype for `bool CompTree::isInternal(CompTree::Position)' does not match any in class `CompTree' Driver2 compTree.cpp line 41 1208892430959 2011
prototype for `bool CompTree::isExternal(CompTree::Position)' does not match any in class `CompTree' Driver2 compTree.cpp line 45 1208892430959 2013
`v' undeclared (first use this function) Driver2 compTree.cpp line 50 1208892430959 2015
prototype for `void CompTree::swap(CompTree::Position, CompTree::Position)' does not match any in class `CompTree' Driver2 compTree.cpp line 56 1208892430959 2016
make: *** [compTree.o] Error 1 Driver2 line 0 1208892430959 2018
Code:
#ifndef COMPTREE_H_
#define COMPTREE_H_
#include <vector>
using namespace std;
class CompTree {
public:
class Position;
CompTree();
Position add(int x);
Position last();
Position root();
Position leftChild(Position &p);
Position rightChild(Position &p);
Position sibling(Position &p);
Position parent(Position &p);
int remove();
int removeRoot();
bool isInternal(Position &p);
bool isExternal(Position &p);
bool isEmpty();
void swap(Position &p1, Position &p2);
int size();
~CompTree();
vector<int> v;
class Position {
public:
Position(int r) {rank = r;}
int element(){return v.at(rank);}
bool isNull{
if(rank == -1)
return true;
else
return false;
}
int getRank(){return rank;}
void setRank(int r){rank = r;}
private:
int rank;
};
};
#endif /*COMPTREE2_H_*/
Code:
#include "compTree.h"
CompTree::CompTree(){}
CompTree::Position CompTree::add(int x){
}
int CompTree::remove(){
}
int CompTree::removeRoot(){
}
CompTree::Position CompTree::last(){
}
Position CompTree::root(){
}
Position CompTree::leftChild(Position &p){
}
Position CompTree::rightChild(Position &p){
}
Position CompTree::sibling(Position &p){
}
Position CompTree::parent(Position &p){
}
bool CompTree::isInternal(Position &p){
}
bool CompTree::isExternal(Position &p){
}
bool CompTree::empty(){
if(v.at(1) != -1)
return false;
else
return true;
}
void CompTree::swap(Position &p1, Position &p2){
}
int CompTree::size(){
}
CompTree::~CompTree(){};