-
按位查找
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; }