Thursday, 22 March 2012

Print Rational Number


#include <iostream>
using namespace std;
class rational
{
private:
int num;
int denum;
public:
void get()
{
cout<<"enter numerator: "<<endl;
cin>>num;
cout<<"enter denomirator: "<<endl;
cin>>denum;
}
void print()
{
cout<<"you Entered: "<<endl;
cout<<num<<"/"<<denum<<endl;
cout<<endl;
}
};

void main()

{
rational r1;
r1.get();
r1.print();
}

No comments:

Post a Comment