Identify the compiler errors and state what is wrong with the code.

```
#include
<< using namespace std;
class Dolphin
{
private:
float size;
string name;
public:
Dolphin(){name = “Tosser”; }
void SetSize(float s) { size = s;}
bool operator > ();
};
void Dolphin::operator > () should be operator(Dolphin X)
{
if(X.size > size) return false;
else return true;
}
int main()
{
Dolphin Big, Little;
Big.SetSize(20);
Small.SetSize(15);
if(Big > Little) cout << “bigger”;
else cout << “smaller”.
}
```

```
#include << need and
<< using namespace std;
class Dolphin
{
private:
float size;
string name;
public:
Dolphin(){name = “Tosser”; }
void SetSize(float s) { size = s;}
bool operator > ();
};
void Dolphin::operator > () should be operator(Dolphin X)
{
if(X.size > size) return false; << need input object X to do this
else return true;
}
int main()
{
Dolphin Big, Little;
Big.SetSize(20);
Small.SetSize(15);
if(Big > Little) cout << “bigger”;
else cout << “smaller”. << need a ; here, and return 0;
}
```

Computer Science & Information Technology

You might also like to view...

Verdana and Arial are examples of serif fonts

Indicate whether the statement is true or false

Computer Science & Information Technology

There is no import or export command for moving Access data to a(n) ________

A) Excel worksheet B) PowerPoint presentation C) Word document D) Text file

Computer Science & Information Technology