Need help with overloading question

Hi, please help withe the following the problem from a self test question, i have a mid term tomorrow and dont get it. Thanks.

Following is the defintion of the class Percent. Objects of type Percent rep. percentages such as 10% or 99%. Give definitions of the overloaded operators >> and << so that they can be used for input and output with objects of class Percent. Assume that input always consists of an integer followed by the character '%', such as 25%. All percentages are whole numbers and are stored in the int member variable named value. You dont need to define the constructor , only have to define the overloaded operators >> and <<.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
  #include <iostream>
using namespace std;

class Percent
{
public:
	friend bool operator ==(const Percent& first, const Percent& second);
	friend bool operator <(const Percent& first, const Percent& second);
	Percent();
	friend istream& operator >> (istream& inputStream, Percent& aPercent);
	friend ostream& operator << (ostream& outputStream, Percent& aPercent);
private:
	int value;
};
closed account (48T7M4Gy)
https://www3.ntu.edu.sg/home/ehchua/programming/cpp/cp7_OperatorOverloading.html

Try this article - example 3.3
Topic archived. No new replies allowed.