大家帮我看一下这个程序哪里有问题
设计个计算器类Calculator,它只有一个用于计数的数据成员count。该计算器的有效计数范围是0~65535,实现计数器的前自增,后自增,前自减,后自减,两个计数器想加减等运算。下面是我写的程序,但是总是“有一个无法解析的外部xx”,哪里有问题阿???
#include<iostream>
using namespace std;
class Calculator{
private:
int count;
public:
Calculator(int i=0){count=i;}
Calculator & operator++();
Calculator & operator++(int);
Calculator & operator--();
Calculator & operator--(int);
Calculator operator+(Calculator a);
Calculator operator<<(Calculator a);
Calculator operator>>(Calculator a);
};
Calculator & Calculator::operator++(){
++count;
return *this;
}
Calculator & Calculator::operator++(int){
count++;
return *this;
}
Calculator & Calculator::operator--(){
--count;
return *this;
}
Calculator & Calculator::operator--(int){
count--;
return *this;
}
Calculator Calculator::operator+(Calculator a){return Calculator(count+a.count);}
Calculator Calculator::operator<<(Calculator a)
{cout<<count<<endl;
return count;}
Calculator Calculator::operator>>(Calculator a)
{cin>>count;
return count;}
void main()
{
int a;
Calculator b;
Calculator sum;
Calculator c;
cout<<"请输入数字: "<<endl;
cin>>a;
if(a>65535||a<0)
{cout<<"该数字超出该计数器的有效计数范围!"<<endl;}
else{
cout<<"请再次输入该数字: "<<endl;
b.operator>>(b);
++b;
cout<<"前自增的结果是:"<<endl;
b.operator<<(b);
b++;
cout<<"后自增的结果是:"<<endl;
b.operator<<(b);
--b;
cout<<"前自减的结果是:"<<endl;
b.operator<<(b);
b--;
cout<<"后自减的结果是:"<<endl;
b.operator<<(b);
cout<<"请输入要加的数字:"<<endl;
c.operator>>(c);
sum=c + b;
sum.operator<<(sum);}
}