6 marks for example it can be used by the following

Info iconThis preview shows page 1. Sign up to view the full content.

View Full Document Right Arrow Icon
This is the end of the preview. Sign up to access the rest of the document.

Unformatted text preview: marks) For example, it can be used by the following code segment. Fraction f(4,7); cout << f.half() << endl; The expected output is 2/7. (f itself is not changed). fraction.h #include <iostream> using namespace std; //The Fraction Class class Fraction { public: Fraction(); // Constructor: create 0/1 Fraction(int n, int d); // Constructor: create n/d and reduce it to its simplest form .. private: .. int numer, denom; fraction.cpp }; #include "fraction.h" ... 1/3 Lecture 10 Helena Wong / CS2331 Problem Solving and Programming (10-11 Sem A) (c) State and briefly describe the mistake(s) of the following function header for the extraction operato...
View Full Document

This document was uploaded on 10/15/2013.

Ask a homework question - tutors are online