> The value can only take the distict values as per requirement . ie { 6.22, 3.44, 7.8, 0, 1, 2}
So perhaps don't treat them as floats, but as fixed point numbers instead.

Internally, you would store these as
622, 344, 780, 0, 100, 200

You would read 6.22 as a pair of integers, separated by a dot.
Code:
class frac {
  int int_part;
  int frac_part;
public:
    friend ostream & operator << (ostream &out, const frac &c);
    friend istream & operator >> (istream &in,  frac &c);
};
https://www.geeksforgeeks.org/overlo...n-operators-c/

The somewhat interesting part will be handling the optional dot.