本文整理汇总了C++中BankAccount::setLastName方法的典型用法代码示例。如果您正苦于以下问题:C++ BankAccount::setLastName方法的具体用法?C++ BankAccount::setLastName怎么用?C++ BankAccount::setLastName使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类BankAccount
的用法示例。
在下文中一共展示了BankAccount::setLastName方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: newAccount
int newAccount(BankAccount account[], int max_accounts, int num_accts){
BankAccount * b;
//make sure there is space left
if(num_accts+1 <= max_accounts){
b = &account[num_accts];
string fname, lname, type;
int SSN;
double acctbalance;
cout << endl << "Please enter first name: ";
cin >> fname;
cout << endl << "Please enter last name: ";
cin >> lname;
cout << endl << "Please enter SSN (Social Security Number): ";
cin >> SSN;
cout << endl << "Please enter Account Type: ";
cin >> type;
cout << endl << "Please enter Account starting Balance: ";
cin >> acctbalance;
b->setFirstName(fname);
b->setLastName(lname);
b->setSSN(SSN);
//increment the account number
int greatest = 0;
BankAccount * g;
for(int i=0; i < num_accts; i++){
g = &account[i];
if(g->getAccountNumber() > greatest){
greatest = g->getAccountNumber();
}
}
greatest++;
b->setAccountNumber(greatest);
b->setAccountType(type);
b->setAccountBalance(acctbalance);
num_accts++;
return num_accts;
}
示例2: read_accts
//Account Functions --------------------------------------------------------------------------------------------------------
int read_accts(BankAccount account[], int max_accounts){
//start counter
int count = 0;
//temporary variables
string fname, lname, type;
int SSN;
double acctbalance;
//count how moany entries are in the file.
while(!File.eof() && count < max_accounts){
File >> fname >> lname >> SSN >> type >> acctbalance;
count++;
}
//loop back to top of file.
File.clear();
File.seekg(0, ios::beg);
//counter for our current account
int i = 0;
//create pointer for changing the values at the direct address in memory
BankAccount * b;
//loop trhough file and save and set values
while(!File.eof() && i < count){
//set our current account into our pointer variable
b = &account[i];
//define our file format
File >> fname >> lname >> SSN >> type >> acctbalance;
//set all of our values
b->setFirstName(fname);
b->setLastName(lname);
b->setSSN(SSN);
b->setAccountNumber(i);
b->setAccountType(type);
b->setAccountBalance(acctbalance);
i++;
}
return count;
}