The union bank needs to convert rupees to dollar and vice versa perform this conversion using conversion routines (here rupees and dollar are two classes).
#include<bits/stdc++.h>
using namespace std;
class Dollar{
private:
int dollar;
public:
Dollar(int d = 0):dollar(d){}
void display(){
cout<<"Dollar value:"<<dollar<<endl;
}
int getValue(){
return dollar;
}
};
class Rupee {
private:
int rupee;
public:
Rupee(int r = 0):rupee(r){}
Rupee(Dollar d){
rupee = 74.95 * d.getValue();
}
void display(){
cout<<"Rupee value:"<<rupee<<endl;
}
};
int main(){
Dollar d1(100);
Rupee r1;
r1 = d1;
d1.display();
r1.display();
return 0;
}
Comments
Leave a comment