Beispiel #1
0
    static void Main(string[] args)
    {
        PHANSO B = XuLyPhanSo.Doc("PhanSo.txt");
        PHANSO A = XuLyPhanSo.Nhap("Nhap phan so :\n");

        QUANHE kq = XuLyPhanSo.SoSanh(A, B);
        String Chuoi;

        Chuoi = XuLyPhanSo.XuatChuoi(A) + "kq" + XuLyPhanSo.XuatChuoi(B);
        if (kq == QUANHE.NhoHon)
        {
            Chuoi = Chuoi.Replace("kq", "<");
        }
        else
        if (kq == QUANHE.BangNhau)
        {
            Chuoi = Chuoi.Replace("kq", "=");
        }
        else
        if (kq == QUANHE.LonHon)
        {
            Chuoi = Chuoi.Replace("kq", ">");
        }
        XuLyChuoi.Xuat(Chuoi);
    }
Beispiel #2
0
    public static PHANSO LonNhat(ArrayList a)
    {
        PHANSO lc = (PHANSO)a[0];

        foreach (PHANSO x in a)
        {
            if (XuLyPhanSo.SoSanh(x, lc) == QUANHE.LonHon)
            {
                lc = x;
            }
        }
        return(lc);
    }
    static void Main(string[] args)
    {
        ArrayList b     = XuLyDayPhanSo.Doc("PhanSo.inp");
        String    Chuoi = "Du lieu khong hop le.";

        if (b != null)
        {
            PHANSO lc = XuLyDayPhanSo.LonNhat(b);
            Chuoi = "Day so:" + XuLyDayPhanSo.XuatChuoi(b) + "\n";
            Chuoi = Chuoi + "Co phan so lon nhat la:" + XuLyPhanSo.XuatChuoi(lc) + "\n";
        }
        XuLyChuoi.Xuat(Chuoi);
    }
Beispiel #4
0
    public static String XuatChuoi(ArrayList a)
    {
        String temp = "";

        for (int i = 0; i < a.Count; i++)
        {
            PHANSO x = (PHANSO)a[i];
            temp = temp + XuLyPhanSo.XuatChuoi(x);
            if (i < a.Count - 1)
            {
                temp = temp + ChuoiPhanCach;
            }
        }
        return(temp);
    }
Beispiel #5
0
    public static Boolean KiemTra(String Chuoi)
    {
        Boolean temp = true;

        String[] M = Chuoi.Split(new String[] { ChuoiPhanCach }, StringSplitOptions.None);
        temp = (M.Length > 0);
        if (temp)
        {
            foreach (String ChuoiCon in M)
            {
                temp = temp && XuLyPhanSo.KiemTra(ChuoiCon);
            }
        }
        return(temp);
    }
Beispiel #6
0
    public static ArrayList KhoiTao(String Chuoi)
    {
        ArrayList temp = null;

        if (KiemTra(Chuoi))
        {
            String[] M = Chuoi.Split(new String[] { ChuoiPhanCach }, StringSplitOptions.None);
            temp = new ArrayList();
            foreach (String ChuoiCon in M)
            {
                temp.Add(XuLyPhanSo.KhoiTao(ChuoiCon));
            }
        }
        return(temp);
    }