示例#1
0
    static void Main(string[] args)
    {
        PHAN_SO A, B, kq;

        A  = XL_PHAN_SO.Nhap("Nhap phan so thu nhat:\n");
        B  = XL_PHAN_SO.Nhap("Nhap phan so thu hai:\n");
        kq = XL_PHAN_SO.Tong(A, B);
        String Chuoi;

        Chuoi = XL_PHAN_SO.Chuoi(A) + " + ";
        Chuoi = Chuoi + XL_PHAN_SO.Chuoi(B) + " = ";
        Chuoi = Chuoi + XL_PHAN_SO.Chuoi(kq);
        XL_CHUOI.Xuat(Chuoi);
    }
示例#2
0
    public static PHAN_SO Tinh(BIEU_THUC P)
    {
        PHAN_SO kq;

        kq = P.So_hang[0];
        for (int i = 1; i < P.So_hang.GetLength(0); i++)
        {
            if (P.Toan_tu[i - 1] == TOAN_TU.Cong)
            {
                kq = XL_PHAN_SO.Tong(kq, P.So_hang[i]);
            }
            else
            if (P.Toan_tu[i - 1] == TOAN_TU.Tru)
            {
                kq = XL_PHAN_SO.Hieu(kq, P.So_hang[i]);
            }
        }
        return(kq);
    }