|
_____________________________
|
|
_____________________________
|
|
|
_____________________________
|
|
_____________________________
|
|
_____________________________
|
#include<iostream> #include<string> using namespace std; class kma {
private: int x; int y;
public: kma(int a,int b,int obb) { setIntValue(a,b,obb); }
void setIntValue(int a,int b,int obb) { x=a/obb; y=b/obb; }
void dispMess() { cout<<"simplificated value is = "<<x<<'/'<<y<<endl; } };
int obeb(int a,int b) { if(b==0) return a; else return obeb(b,a%b); } int main() { int v1=0,v2=0,obb=0; cout<<"Enter two values for simplification\n"; cin>>v1>>v2; obb = obeb(v1,v2); kma obj(v1,v2,obb);
cout<<"value that is your entered: "<<v1<<"/"<<v2<<endl;
obj.dispMess(); return EXIT_SUCCESS; } |
_____________________________
|