#include <iostream>
using namespace std;
#include<cmath>
class number
{
private :int son,mother;
public:   number (int son2,int mother2)
        {    int a,b,k,i=0;

            if(son2>mother2)
                { a=son2;b=mother2;}
            else {a=mother2;b=son2;}

             for( ; ;i++)
             {if(a%b==0)  break;                  
             else  { k=a;a=b;b=k%b;} }
              
            son=son2/b;mother=mother2/b;

          }
        void show()
        {cout<<"son/mother="<<son<<"/"<<mother<<endl;}
};
void main()
{
    number a(90,21),b(6,9),c(49,3);
    a.show();
    b.show();
    c.show();
}




posted on 2013-02-23 16:00  叶城宇  阅读(202)  评论(0编辑  收藏  举报