So for this function, I'm trying to take an input (may be a user input or an input file) and put that into a variable. The function: istream & operator>>(istream &is, Event &e)
What direction should I take to implement this? I'm completely stumped, and I really need this done asap. Thank you!
Alright I did a project that had to overload input/output in my first programming class so here you go. It is for rational numbers and for a class but it should give you the idea and you can adapt it. in class header: friend istream &operator>> (istream &, Rational &);
class cpp:
1 2 3 4 5 6 7 8
istream &operator>>(istream& stream, Rational& obj)
{
cout << "Numerator for first number: ";
stream >> obj.p;
cout << "Denominator for first number: ";
stream >> obj.q;
return stream;
}
the class name is rational which is the object in the second parameter so you dont get confused.