overloading an arithmetic operator

//I have written this program to calculate and display the ratio of two //different offices sales. But I'm getting two error messages I can't seem to //figure out whats wrong.





#include "stdafx.h"
#include<iostream>
#include<conio.h>
#include<string>
using namespace std;

class SalesOffice
{
private:
string officeName;
double sales;
public:
SalesOffice(string, double);
double operator/(SalesOffice);
};

SalesOffice::SalesOffice(string office, double salesAmt);
{
officeName = office;
sales = salesAmt;
}

double SalesOffice::operator/(SalesOffice office)
{
double ratio;
ratio = sales / office.sales;
return ratio;
}

int main()
{
SalesOffice north("North", 2454.88);
SalesOffice south("South", 2830.92);
double ratio;
ratio = north / south;
cout << "The North Office has " << (ratio * 100) <<
"% of the sales of South Office" << endl;
_getch();
return 0;
}
You made a typo inserting ';' after the parameter list in the definition

SalesOffice::SalesOffice(string office, double salesAmt); // <== here remove ";"
{
officeName = office;
sales = salesAmt;
}
Topic archived. No new replies allowed.