Submitted by Muzammil Muneer on Wednesday, October 22, 2014 - 10:19.

#include<iostream> #include<conio.h> using namespace std;

class fraction { private: //access specifier int num; int denom; public: void getfraction(){ cout << "Fraction is: " << num << "/" << denom; } void setfraction(){ cout << "Enter numerator: "; cin >> num; cout << "Enter denominator: "; cin >> denom; } fraction addfraction(fraction f); }; fraction fraction :: addfraction(fraction f){ fraction sum; sum.num = (this->num*f.denom) + (this->denom*f.num); sum.denom = this->denom*f.denom; return sum; }

- 39 views