The code is really long so I don't want to post all of it, but I'm posting the part I'm having an issue with. This is part of a fraction class I'm writing. Most of it is working but for there is something wrong with the istream because when I enter a fraction it just says d=0.
This is my input overload:
istream& operator>>(istream& in, fraction& x)
{
int a;
int b;
char c;
in >> a >> c >> b;
fraction z=(a/b);
x=z;
return in;
}
This is the part in main:
fraction d;
cout << "Enter a fraction: ";
cin >> d;
cout << "d=" << d << endl;
What am I doing wrong?