Create a Rati mo
c++ question
pleas copy n paste ur working code here
ANS- Source code-
#include<iostream>
// #include<conio.h>
using namespace std;
class findRational
{
private:
int num,den;
public:
void set(int n,int d)
{
num=n;
den=d;
}
void put()
{
cout<<"Rational Number as:";
cout<<num<<"/"<<den;
}
void find(findRational num1, findRational num2)
{
num=num1.num*num2.den+num2.num*num1.den;
den=num1.den*num2.den;
}
};
int main()
{
findRational ob1 ,ob2,ob3;
ob1.set(5,7);
ob2.set(1,7);
ob3.find(ob1,ob2);
ob3.put();
return 0;
}
Step by step
Solved in 3 steps with 2 images