本文整理汇总了C++中Customer::printCustomer方法的典型用法代码示例。如果您正苦于以下问题:C++ Customer::printCustomer方法的具体用法?C++ Customer::printCustomer怎么用?C++ Customer::printCustomer使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Customer
的用法示例。
在下文中一共展示了Customer::printCustomer方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: main
int main()
{
Bank bank1; //this bank uses linked lists for its customers and accounts.
cout << "--BANK DATABASE IMPLEMENTED USING LINKED LISTS--" << endl << endl;
//CUSTOMER LINKED LIST
ifstream in1;
in1.open("customers0.txt");
if (in1.fail())
{
cout << "unable to open customers0.txt" << endl;
return 0;
}
while (!in1.eof())
{
Customer *newCustomer = new Customer();
in1 >> (newCustomer -> customerID) >> (newCustomer -> lastName);
in1 >> (newCustomer -> firstName) >> (newCustomer -> address);
bank1.addCustomer(newCustomer);
}
in1.close();
int totalcustomers = bank1.getccurrentlyInList();
cout << "Total number of customers: " << totalcustomers << endl;
//ACCOUNT LINKED LIST
ifstream in2;
in2.open("accounts0.txt");
if (in2.fail())
{
cout << "unable to open accounts0.txt" << endl;
return 0;
}
while (!in2.eof())
{
Account *newAccount = new Account();
in2 >> (newAccount -> accountID) >> (newAccount -> customerID);
in2 >> (newAccount -> balance);
bank1.addAccount(newAccount);
}
in2.close();
int totalaccounts = bank1.getacurrentlyInList();
cout << "Total number of accounts: " << totalaccounts << endl;
int totalbalance = bank1.getTotalAccountsBalance();
cout << "Total Accounts Balance: " << totalbalance << " cents" << endl;
int customerIDSearch;
cout << "Enter Customer ID: ";
cin >> customerIDSearch;
bank1.search(customerIDSearch); //this search function calls the printCustomer() function within it.
int numberOfComparisons = bank1.getNumberOfComparisonsLL();
cout << "Number of Comparisons made (linked list): " << numberOfComparisons << endl;
//----------------------------------------------------------------------------------------
//----------------------------------------------------------------------------------------
Bank bank2; //this bank uses binary search trees for its customers and accounts.
cout << endl << "--BANK DATABASE IMPLEMENTED USING BINARY SEARCH TREES--" << endl << endl;
//CUSTOMER BINARY SEARCH TREE
ifstream in3;
in3.open("customers0.txt");
if (in3.fail())
{
cout << "unable to open customers0.txt" << endl;
return 0;
}
while (!in3.eof())
{
Customer *newCustomer = new Customer();
in3 >> (newCustomer -> customerID) >> (newCustomer -> lastName);
in3 >> (newCustomer -> firstName) >> (newCustomer -> address);
//The following two lines of code prints out the details of every customer added (used for debugging purposes)
//cout << newCustomer->customerID << " " << newCustomer->lastName << " ";
//cout << newCustomer->firstName << " " <<newCustomer->address << endl;
bank2.addCustomerBST(newCustomer);
}
in3.close();
totalcustomers = bank2.getccurrentlyInList();
//.........这里部分代码省略.........