05. 线性表——顺序表,按值查找,按位查找(查)

  • 按位查找

    Customer GetCustomer(CustomerList customerList, int i){
        return customerList.CList[i-1];
    }
    
  • 按值查找

    bool CustomerEqual(Customer customer, Customer customer1){
        if((customer.num == customer1.num)&&(customer.numberOfPeople == customer1.numberOfPeople)){
            return true;
        }
        return false;
    }
    int LocateCustomer(CustomerList customerList, Customer customer){
        for (int i = 0; i < customerList.length; i++) {
            if(CustomerEqual(customer, customerList.CList[i])){
                return i+1;
            }
        }
        return 0;
    }
    
上一篇:ui自动化实现浏览器登陆(python+selenium)


下一篇:table表格高级用法(二)