示例#1
0
void BankAccount::BankAccountChoice()
{
	switch (choice)
	{
	case 1:
		displayOwner();
		break;
	case 2:
		displayBalance();
		break;
	case 3:
		displayCreationDay();
		break;
	case 4:
		enterDeposit();
		break;
	case 5:
		enterWithdrawal();
		break;
	case 9: 
		cout << "\nYou have successfully logged out.\n\n";
		saveFile();
		system("cls");
		LogIn::mainMenu();
		break;
	}

	BankAccountMenu();
}
示例#2
0
void tableDisplay(My570List *list) {

/*
    +-----------------+--------------------------+----------------+----------------+
    |       Date      | Description              |         Amount |        Balance |
    +-----------------+--------------------------+----------------+----------------+
    | Thu Aug 21 2008 | ...                      |      1,723.00  |      1,723.00  |
    | Wed Dec 31 2008 | ...                      | (       45.33) |      1,677.67  |
    | Mon Jul 13 2009 | ...                      |     10,388.07  |     12,065.74  |
    | Sun Jan 10 2010 | ...                      | (      654.32) |     11,411.42  |
    +-----------------+--------------------------+----------------+----------------+
Each line is exactly 80 characters long (followed by a single "\n" character).
The Date field spans characters 3 through 17. Please use ctime() to format the timestamp 
and remove unnecessary characters to make it look like what's in the table above. 
The Description field spans characters 21 through 44. (If a description is too long,
you must truncate it.) The Amount field spans characters 48 through 61. For a withdrawal,
a pair of paranthesis must be used as indicated. If the amount of a transaction
is more than or equal to 10 million, please print ?,???,???.?? (or (?,???,???.??))
in the Amount field. The Balance field spans characters 65 through 78.
If a balance is negative, a pair of paranthesis must be used.
If the absolute value of a balance is more than or equal to 10 million, please print ?,???,???.?? (or (?,???,???.??)) in the Balance field.
 */
	double balance = 0;
 	fprintf(stdout,"+-----------------+--------------------------+----------------+----------------+\n");
	fprintf(stdout,"|       Date      | Description              |         Amount |        Balance |\n");
	fprintf(stdout,"+-----------------+--------------------------+----------------+----------------+\n");
	My570ListElem *elem=NULL;
	int recnum = 0;
	for (elem=list->First(); elem != NULL; elem=list->Next(elem)) {
        struct record *temp =(struct record*)(elem->Obj());
		temp->recordnum =recnum;
		recnum++;

		fprintf(stdout,"| ");
		displayDate(temp->timestamp); 		///<will add a space at the end ---TIMESTAMP
		
		fprintf(stdout,"| ");				///< add a | on same line		---DESCRIPTION
		displayDescription(temp->description);
		
		fprintf(stdout,"| ");				///< add a | on same line		---AMOUNT
		displayAmount(temp);
		
		fprintf(stdout,"| ");				///< add a | on same line		---AMOUNT
		balance = displayBalance(balance,temp);
		
		fprintf(stdout,"|");
		fprintf(stdout,"\n");
    }
	fprintf(stdout,"+-----------------+--------------------------+----------------+----------------+\n");	
}