440,602 Members | 1,507 Online
Need help? Post your question and get tips & solutions from a community of 440,602 IT Pros & Developers. It's quick & easy.

# Fraction classes

 P: 30 we're given an implementation file to base our class of Fraction off of. Input and output are in the format x/y, with x and y being ints, with the "/" character in the middle. so to create an object of class Fraction, it'd need to be like Expand|Select|Wrap|Line Numbers Fraction frac1 (3/4) however I'm not sure on how to create this fraction with the format of the .h file we're given Expand|Select|Wrap|Line Numbers class Fraction {   public:       // Construct fraction from numerator and denominator     //     Fraction( int = 0, int = 1 );       // Construct fraction by copying existing fraction     //     Fraction( const Fraction& );       // Assign into fraction by copying existing fraction     //     Fraction& operator=( const Fraction& );       // Return true if fraction is valid (non-zero denominator)     //     bool IsValid() const;       // Return value of numerator     //     int Numerator() const;       // Return value of denominator     //     int Denominator() const;       // Input/Output operations     //     friend istream& operator>>( istream&, Fraction& );     friend ostream& operator<<( ostream&, const Fraction& );   I guess what's tripping me up is the format it's sent in, with the "/" character. if it was Expand|Select|Wrap|Line Numbers  Fraction fract1 ( 3,4); i'd have no problem. If someone could tell me at least how to declare the fraction to be passed around to the other objects, everything else should fall into place Thanks Much, -Myxamatosis Feb 27 '08 #1