0

Hi,

I get some problems when I run the following codes.

```
#include<iostream.h>
class Distance
{
protected:
int feet;
float inches;
public:
Distance() { feet = 0; inches = 0; }
Distance(int ft, float in)
{
feet = ft;
inches = in;
}
void get_dist()
{
cout << "\n Enter feet "; cin >> feet;
cout << "\n Enter inches "; cin >> inches;
}
void show_dist()
{
cout << feet << "\'-" << inches << "\"";
}
};
enum posneg { pos, neg };
class Dist_Sign:public Distance
{
private:
posneg sign;
public:
Dist_Sign():Distance() { sign = pos; }
Dist_Sign(int ft, float in, poseng sg = pos):Distance(ft, in) { sign = sg; }
void get_dist()
{
Distance::get_dist();
char ch;
cout << "Enter sign(+ or -): "; cin >> ch;
sign = (ch=='+')?pos:neg;
}
void show_dist()
{
cout << ((sign==pos)? "(+)":"(-)") ;
Distance::show_dist();
}
};
void main()
{
Dist_Sign alpha;
alpha.get_dist();
Dist_Sign beta(11, 6.25);
Dist_Sign gamma(100, 5.5, neg);
cout << "\n alpha = "; alpha.show_dist();
cout << "\n beta = "; beta.show_dist();
cout << "\n gamma = "; gamma.show_dist();
}
```

That shows (4) errors.

```
1. unexpected 'class Dist_Sign ('
2. unexpected token(s) preceding ':'; skipping apparent function body
3. 'Dist_Sign::Dist_Sign' : no overloaded function takes 2 parameters
4. 'Dist_Sign::Dist_Sign' : no overloaded function takes 3 parameters
```

Regards,

zawpai

*Edited 3 Years Ago by mike_2000_17*: Fixed formatting