1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28
|
#include <iostream>
#include <stdlib.h>
using namespace std;
class rational
{
int num, den, num1, den1, num2, den2;
public:
rational()
{
num=0; den=1;
}
rational(int a, int b, int c, int d)
{
num1=a; den1=b; num2=c; den2=d;
}
};
int main()
{
rational rat;
int p, q, r, s, ch;
cout<<"\nEnter 2 rational numbers.\n\n";
cout<<"Rational A= \n"; cin>>p; cout<<"/"; cin>>q;
cout<<"\nRational B= \n"; cin>>r; cout<<"/"; cin>>s;
rational(p,q,r,s);
}
| |