当前位置: 首页>>代码示例>>C++>>正文


C++ Transfer::GetDestinationAccountNumber方法代码示例

本文整理汇总了C++中Transfer::GetDestinationAccountNumber方法的典型用法代码示例。如果您正苦于以下问题:C++ Transfer::GetDestinationAccountNumber方法的具体用法?C++ Transfer::GetDestinationAccountNumber怎么用?C++ Transfer::GetDestinationAccountNumber使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Transfer的用法示例。


在下文中一共展示了Transfer::GetDestinationAccountNumber方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1:

// Builds transfer history
vector <Page> UI::BuildTransferHistory(stack <Transfer> *listOfTransfers)
{
	// Prepare a vector which stores the lines 
	// to be written to the page which is currently
	// "in progress"
	vector <string> linesToPage;

	// This vector is what is built over the course
	// of the function and eventually returned.
	vector <Page> transferHistory;

	// While their are still lines "waiting to be written" on the stack, loop.
	while (listOfTransfers->size() > 0)
	{
		/******************************************************************************
		*The following code is all about getting the format correct for each line.
		******************************************************************************/

		// We want to work with the transfer on the top of the stack.
		Transfer workingTransfer = listOfTransfers->top();

		// Determine column padding for transferNumber
		int sizeOfNumber = std::to_string(workingTransfer.GetTransactionNumber()).length();
		string transferNumColumnPadding = "";

		// Build the column padding
		for (sizeOfNumber; sizeOfNumber < 7; sizeOfNumber++)
		{
			transferNumColumnPadding += " ";
		}

		// Determine column padding for sourceAccount
		sizeOfNumber = std::to_string(workingTransfer.GetAccountNumber()).length();
		string sourceAccountColumnPadding = "";

		// Build the column padding
		for (sizeOfNumber; sizeOfNumber < 5; sizeOfNumber++)
		{
			sourceAccountColumnPadding += " ";
		}

		// Determine column padding for destinationAccount
		sizeOfNumber = std::to_string(workingTransfer.GetDestinationAccountNumber()).length();
		string destinationAccountColumnPadding = "";

		// Build the column padding
		for (sizeOfNumber; sizeOfNumber < 5; sizeOfNumber++)
		{
			destinationAccountColumnPadding += " ";
		}

		// Format transferAmt output and determine column padding for transferAmt
		string retTransAmt = std::to_string(workingTransfer.GetTransactionAmount());
		size_t dotIndex = retTransAmt.find(".");
		retTransAmt = retTransAmt.substr(0, dotIndex + 3);
		int sizeOfTransferAmt = retTransAmt.length();
		string transferAmtColumnPadding = "";

		// Build the column padding
		for (sizeOfTransferAmt; sizeOfTransferAmt < 10; sizeOfTransferAmt++)
		{
			transferAmtColumnPadding += " ";
		}

		// Build the line item
		string additionalLine = "      " + std::to_string(workingTransfer.GetTransactionNumber()) +
			transferNumColumnPadding + " |  " +
			std::to_string(workingTransfer.GetAccountNumber()) +
			sourceAccountColumnPadding + " |  " +
			std::to_string(workingTransfer.GetDestinationAccountNumber()) +
			destinationAccountColumnPadding + " |  $" +
			transferAmtColumnPadding +
			retTransAmt + " |  " +
			workingTransfer.GetDate();

		// Add the line item to the list of lines to be written in the report.
		linesToPage.push_back(additionalLine);

		// Reduce the size of the stack by one
		listOfTransfers->pop();
	}

	// This variable stores the number of lines (transactions)
	// which have been written.
	unsigned int numberOfLinesWritten = 0;

	// As long as there are still lines that need to be written, loop
	while (numberOfLinesWritten < linesToPage.size())
	{
		// Create a new page with room for 10 total lines.
		Page page;

		// While there is still room to write on the page, add an additional line from the vector
		// made above.  Be sure to increment the numberOfLinesWritten as we add to each page.
		for (unsigned int i = 0; i < page.GetMaximumNumberOfLines() && numberOfLinesWritten < linesToPage.size(); i++, numberOfLinesWritten++)
		{
			page.AddLine(linesToPage[numberOfLinesWritten]);
		}

//.........这里部分代码省略.........
开发者ID:DannyBobby,项目名称:dglidewellATM,代码行数:101,代码来源:UI.cpp


注:本文中的Transfer::GetDestinationAccountNumber方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。