cleaning up excess projects
This commit is contained in:
@@ -1,108 +0,0 @@
|
||||
#include "BankAccount.h"
|
||||
#include <iostream>
|
||||
#include <sstream>
|
||||
#include <iomanip>
|
||||
#include <cstdlib> // For rand()
|
||||
#include <random> // For better random number generation
|
||||
#include <ctime>
|
||||
#include <cstring> // For memset
|
||||
#include <cmath> // For floor
|
||||
#include <chrono> // For time manipulation
|
||||
#include <locale> // For locale settings
|
||||
#include <codecvt> // For codecvt_utf8
|
||||
#include <stdexcept> // For std::invalid_argument
|
||||
#include <string>
|
||||
|
||||
|
||||
TBankAccount::TBankAccount(EBankAccountType accType, std::string firstName, std::string lastName)
|
||||
: accountType(accType), ownerFirstName(firstName), ownerLastName(lastName)
|
||||
{
|
||||
// Random genration of account number: XXXX.XX.XXXXX
|
||||
accountNumber = toString(rand() % 9000 + 1000) + "." + toString(rand() % 90 + 10) + "." + toString(rand() % 90000 + 10000);
|
||||
|
||||
balance = 0.0f;
|
||||
|
||||
//Random generation of creation timestamp, date is any date and time in 2024
|
||||
int month = rand() % 12 + 1;
|
||||
int day = rand() % 28 + 1; // To avoid complexity of different month lengths
|
||||
int hour = rand() % 24;
|
||||
int minute = rand() % 60;
|
||||
|
||||
// Calculate creation timestamp in seconds from 2024-01-01 00:00:00
|
||||
std:tm tm = {};
|
||||
tm.tm_year = 2024 - 1900; // Year since 1900
|
||||
tm.tm_mon = rand() % 12; // Month [0-11]
|
||||
tm.tm_mday = rand() % 28 + 1; // Day of the month [1-28] to avoid month length issues
|
||||
tm.tm_hour = rand() % 24; // Hour [0-23]
|
||||
tm.tm_min = rand() % 60; // Minute [0-59]
|
||||
tm.tm_sec = 0; // Second [0-59]
|
||||
creationTimestamp = _mkgmtime(&tm); // Use _mkgmtime for UTC
|
||||
|
||||
if (accType == Checking || accType == Saving || accType == Pension)
|
||||
balance = static_cast<double>(rand() % 1001); // 0 to 1000
|
||||
else if (accType == Loan)
|
||||
balance = static_cast<double>(-(rand() % 25001 + 25000)); // -50000 to -25000
|
||||
else if (accType == Credit)
|
||||
balance = static_cast<double>(-(rand() % 1001)); // -1000 to 0
|
||||
}
|
||||
|
||||
TBankAccount::~TBankAccount()
|
||||
{
|
||||
// Destructor logic if needed
|
||||
}
|
||||
|
||||
std::string TBankAccount::getAccountNumber() const {
|
||||
return accountNumber;
|
||||
}
|
||||
|
||||
EBankAccountType TBankAccount::getAccountType() const {
|
||||
return accountType;
|
||||
}
|
||||
|
||||
time_t TBankAccount::getCreationTimestamp() const {
|
||||
return creationTimestamp;
|
||||
}
|
||||
double TBankAccount::getBalance() const {
|
||||
return balance;
|
||||
}
|
||||
void TBankAccount::deposit(double aAmount) {
|
||||
if (aAmount > 0) balance += aAmount;
|
||||
}
|
||||
|
||||
void TBankAccount::withdraw(double aAmount) {
|
||||
if (aAmount > 0 && aAmount <= balance) balance -= aAmount;
|
||||
}
|
||||
|
||||
std::string TBankAccount::getAccountTypeString() const
|
||||
{
|
||||
switch (accountType)
|
||||
{
|
||||
case Checking: return "Checking";
|
||||
case Saving: return "Saving";
|
||||
case Credit: return "Credit";
|
||||
case Pension: return "Pension";
|
||||
case Loan: return "Loan";
|
||||
default: return "Unknown";
|
||||
}
|
||||
}
|
||||
|
||||
//
|
||||
std::string TBankAccount::getCreationTimeString() const
|
||||
{
|
||||
char buffer[26];
|
||||
ctime_s(buffer, sizeof(buffer), &creationTimestamp);
|
||||
std::string timeString(buffer);
|
||||
if (!timeString.empty() && timeString.back() == '\n') {
|
||||
timeString.pop_back(); // Remove the trailing newline character
|
||||
}
|
||||
return timeString;
|
||||
}
|
||||
|
||||
void TBankAccount::printAccountInfo() const
|
||||
{
|
||||
std::cout << "Account Number: " << accountNumber << ", Type: " << getAccountTypeString()
|
||||
<< ", Owner: " << ownerFirstName << " " << ownerLastName
|
||||
<< ", Balance: " << balance
|
||||
<< ", Created: " << getCreationTimeString()
|
||||
<< std::endl;
|
||||
}
|
||||
@@ -1,52 +0,0 @@
|
||||
#pragma once
|
||||
#ifndef BANKACCOUNT_H
|
||||
#define BANKACCOUNT_H
|
||||
|
||||
#include <string> // For std::string
|
||||
#include <ctime> // For time_t
|
||||
#include <cstdlib> // For rand()
|
||||
#include <iomanip> // For std::setfill and std::setw
|
||||
#include <sstream> // For std::ostringstream
|
||||
#include <iostream> // For std::cout
|
||||
|
||||
|
||||
// Helper function to convert value to string
|
||||
template <typename T>
|
||||
std::string toString(T value)
|
||||
{
|
||||
std::ostringstream oss;
|
||||
oss << value;
|
||||
return oss.str();
|
||||
}
|
||||
|
||||
|
||||
enum EBankAccountType { Checking, Saving, Credit, Pension, Loan };
|
||||
|
||||
class TBankAccount {
|
||||
|
||||
private:
|
||||
std::string accountNumber;
|
||||
EBankAccountType accountType;
|
||||
time_t creationTimestamp;
|
||||
double balance;
|
||||
|
||||
public:
|
||||
std::string ownerFirstName;
|
||||
std::string ownerLastName;
|
||||
|
||||
//TBankAccount() {} // Don't use default constructor
|
||||
TBankAccount(EBankAccountType, std::string, std::string);
|
||||
~TBankAccount();
|
||||
|
||||
std::string getAccountNumber() const;
|
||||
std::string getCreationTimeString() const;
|
||||
time_t getCreationTimestamp() const;
|
||||
double getBalance() const;
|
||||
void deposit(double);
|
||||
void withdraw(double);
|
||||
EBankAccountType getAccountType() const;
|
||||
std::string getAccountTypeString() const;
|
||||
void printAccountInfo() const;
|
||||
};
|
||||
|
||||
#endif // BANKACCOUNT_H
|
||||
@@ -1,130 +0,0 @@
|
||||
#include "BankAccountList.h"
|
||||
|
||||
TLinkedList::TLinkedList(bool aOwnsData) : head(nullptr), ownsData(aOwnsData), size(0) {
|
||||
head = new TLinkedListNode(nullptr); // Dummy head node
|
||||
}
|
||||
|
||||
TLinkedList::~TLinkedList()
|
||||
{
|
||||
while (head->next != nullptr)
|
||||
{
|
||||
TLinkedListNode* temp = head->next;
|
||||
head->next = temp->next;
|
||||
if (ownsData) delete temp->data; // Delete the TBankAccount object
|
||||
delete temp; // Delete the node
|
||||
}
|
||||
delete head;
|
||||
}
|
||||
|
||||
int TLinkedList::getSize() const { return size; }
|
||||
|
||||
void TLinkedList::Add(TBankAccount* aData)
|
||||
{
|
||||
TLinkedListNode* newNode = new TLinkedListNode(aData);
|
||||
newNode->next = head->next;
|
||||
head->next = newNode;
|
||||
size++;
|
||||
}
|
||||
|
||||
TBankAccount* TLinkedList::Find(FCompareAccount aCompareFunc, void* aSearchKey)
|
||||
{
|
||||
TLinkedListNode* current = head->next;
|
||||
while (current != nullptr)
|
||||
{
|
||||
if (aCompareFunc(current->data, aSearchKey))
|
||||
{
|
||||
return current->data; // Found
|
||||
}
|
||||
current = current->next;
|
||||
}
|
||||
return nullptr; // Not found
|
||||
}
|
||||
|
||||
TLinkedList* TLinkedList::Every(FCompareAccount aCompareFunc, void* aSearchKey)
|
||||
{
|
||||
TLinkedList* resultList = new TLinkedList(false); // New list does not own data
|
||||
TLinkedListNode* current = head->next;
|
||||
while (current != nullptr)
|
||||
{
|
||||
if (aCompareFunc(current->data, aSearchKey))
|
||||
{
|
||||
resultList->Add(current->data); // Add to result list
|
||||
}
|
||||
current = current->next;
|
||||
}
|
||||
return resultList; // Return the new list
|
||||
}
|
||||
|
||||
// Loop through all accounts, if aEveryFunc returns false for any, return that account
|
||||
TBankAccount* TLinkedList::Every(FEveryAccount aEveryFunc) {
|
||||
TLinkedListNode* current = head->next;
|
||||
int index = 0;
|
||||
while (current != nullptr)
|
||||
{
|
||||
if (!aEveryFunc(current->data, index++))
|
||||
{
|
||||
return current->data; // Return the first account that fails the test
|
||||
}
|
||||
current = current->next;
|
||||
}
|
||||
return nullptr; // All accounts passed the test
|
||||
}
|
||||
|
||||
TBankAccount** TLinkedList::ToArray()
|
||||
{
|
||||
if (size == 0) return nullptr;
|
||||
TBankAccount** array = new TBankAccount * [size];
|
||||
TLinkedListNode* current = head->next;
|
||||
int index = 0;
|
||||
while (current != nullptr && index < size) // Ensure index < size
|
||||
{
|
||||
array[index++] = current->data;
|
||||
current = current->next;
|
||||
}
|
||||
return array;
|
||||
}
|
||||
|
||||
void TLinkedList::forEach(FForEachAccount aFunc)
|
||||
{
|
||||
TLinkedListNode* current = head->next;
|
||||
int index = 0;
|
||||
while (current != nullptr)
|
||||
{
|
||||
aFunc(current->data, index++);
|
||||
current = current->next;
|
||||
}
|
||||
}
|
||||
|
||||
TLinkedListNode* TLinkedList::getHead() const { return head; }
|
||||
|
||||
void TLinkedList::Append(TBankAccount* account)
|
||||
{
|
||||
TLinkedListNode* newNode = new TLinkedListNode(account);
|
||||
TLinkedListNode* current = head;
|
||||
while (current->next != nullptr)
|
||||
{
|
||||
current = current->next;
|
||||
}
|
||||
current->next = newNode;
|
||||
size++;
|
||||
}
|
||||
|
||||
void TLinkedList::Remove(TBankAccount* account)
|
||||
{
|
||||
TLinkedListNode* current = head;
|
||||
while (current->next != nullptr)
|
||||
{
|
||||
if (current->next->data == account)
|
||||
{
|
||||
TLinkedListNode* temp = current->next;
|
||||
current->next = temp->next;
|
||||
if (ownsData) delete temp->data; // Delete the TBankAccount object
|
||||
delete temp; // Delete the node
|
||||
size--;
|
||||
return; // Exit after removing
|
||||
}
|
||||
current = current->next;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -1,51 +0,0 @@
|
||||
#pragma once
|
||||
#ifndef BANKACCOUNTLIST_H
|
||||
#define BANKACCOUNTLIST_H
|
||||
#include "BankAccount.h"
|
||||
#include <string>
|
||||
#include <functional>
|
||||
|
||||
typedef bool (*FCompareAccount)(TBankAccount* account, void* searchKey);
|
||||
typedef void (*FForEachAccount)(TBankAccount* account, int index);
|
||||
typedef bool (*FEveryAccount)(TBankAccount*, int);
|
||||
|
||||
// Node class for linked list
|
||||
class TLinkedListNode
|
||||
{
|
||||
public:
|
||||
TBankAccount* data;
|
||||
TLinkedListNode* next;
|
||||
TLinkedListNode(TBankAccount* aData) : data(aData), next(nullptr) {}
|
||||
~TLinkedListNode()
|
||||
{
|
||||
// Destructor logic if needed
|
||||
}
|
||||
};
|
||||
|
||||
// Use dummy head node for simplicity
|
||||
class TLinkedList
|
||||
{
|
||||
private:
|
||||
TLinkedListNode* head;
|
||||
bool ownsData;
|
||||
int size;
|
||||
public:
|
||||
TLinkedList(bool);
|
||||
~TLinkedList();
|
||||
int getSize() const;
|
||||
TLinkedListNode* getHead() const;
|
||||
|
||||
void Add(TBankAccount*);
|
||||
|
||||
TBankAccount* Find(FCompareAccount, void*);
|
||||
|
||||
TLinkedList* Every(FCompareAccount, void*);
|
||||
TBankAccount* Every(FEveryAccount aEveryFunc);
|
||||
TBankAccount** ToArray();
|
||||
void forEach(FForEachAccount);
|
||||
|
||||
void Append(TBankAccount* account);
|
||||
void Remove(TBankAccount* account);
|
||||
};
|
||||
|
||||
#endif// BANKACCOUNTLIST_H
|
||||
@@ -1,25 +0,0 @@
|
||||
# CMakeList.txt : CMake project for Submission-01, include source and define
|
||||
# project specific logic here.
|
||||
#
|
||||
|
||||
# Add source to this project's executable.
|
||||
add_executable (Submission-04 "main.cpp" "main.h" "BankAccount.h" "ReadNames.cpp" "ReadNames.h" "BankAccount.cpp" "BankAccount.h" "BankAccountList.cpp" "BankAccountList.h")
|
||||
target_link_libraries(Submission-04 PRIVATE LibExample)
|
||||
|
||||
# Add source files to a Submission04Lib library
|
||||
add_library(Submission04Lib
|
||||
BankAccount.cpp
|
||||
BankAccount.h
|
||||
ReadNames.cpp
|
||||
ReadNames.h
|
||||
BankAccountList.cpp
|
||||
BankAccountList.h
|
||||
)
|
||||
|
||||
target_include_directories(Submission04Lib PUBLIC ${CMAKE_CURRENT_SOURCE_DIR})
|
||||
|
||||
if (CMAKE_VERSION VERSION_GREATER 3.20)
|
||||
set_property(TARGET Submission-03 PROPERTY CXX_STANDARD 20)
|
||||
endif()
|
||||
|
||||
# TODO: Add tests and install targets if needed.
|
||||
@@ -1,31 +0,0 @@
|
||||
#include <iostream>
|
||||
#include <fstream>
|
||||
#include <sstream>
|
||||
#include <string>
|
||||
#include "ReadNames.h"
|
||||
|
||||
void readNamesFromFile(const std::string& aFilename, FNameRead aOnNameRead)
|
||||
{
|
||||
if (aFilename.empty()) return;
|
||||
std::ifstream file(aFilename);
|
||||
if (!file.is_open())
|
||||
{
|
||||
std::cerr << "Error opening file: " << aFilename << std::endl;
|
||||
return;
|
||||
}
|
||||
std::string line;
|
||||
while (std::getline(file, line))
|
||||
{
|
||||
std::istringstream iss(line);
|
||||
std::string firstName, lastName;
|
||||
if (iss >> firstName >> lastName)
|
||||
{
|
||||
if (aOnNameRead) // If the callback is set, call it
|
||||
{
|
||||
//If the function returns false, stop reading further
|
||||
if (!aOnNameRead(firstName, lastName)) break;
|
||||
}
|
||||
}
|
||||
}
|
||||
file.close();
|
||||
}
|
||||
@@ -1,30 +0,0 @@
|
||||
#pragma once
|
||||
#ifndef READNAMES_H
|
||||
#define SHARED_LIB_H
|
||||
#include <string>
|
||||
#include <functional>
|
||||
|
||||
/// <summary>
|
||||
/// Use this delegate type to define a callback function for processing names read from a file.
|
||||
/// </summary>
|
||||
/// <delegate>FNameRead</delegate>
|
||||
/// <description>A function pointer type for a callback that processes names read from a file.</description>
|
||||
/// <param name="firstName">The first name read from the file.</param>
|
||||
/// <param name="lastName">The last name read from the file.</param>
|
||||
/// <returns>Returns true to continue reading names, or false to stop.</returns>
|
||||
typedef bool (*FNameRead)(const std::string& firstName, const std::string& lastName);
|
||||
|
||||
/// <summary>
|
||||
/// Use this function to read names from a specified file and process them using a callback function.
|
||||
/// </summary>
|
||||
/// <function>readNamesFromFile</function>
|
||||
/// <description>Reads names from a specified file and invokes a callback for each name read.</description>
|
||||
/// <param name="aFilename">The path to the file containing names.</param>
|
||||
/// <param name="aOnNameRead">A callback function that is called for each name read. It takes two parameters: firstName and lastName. If the callback returns false, the reading process stops.</param>
|
||||
/// <param name="firstName">The first name read from the file.</param>
|
||||
/// <param name="lastName">The last name read from the file.</param>
|
||||
/// <returns>None.</returns>
|
||||
void readNamesFromFile(const std::string& aFilename, FNameRead aOnNameRead);
|
||||
|
||||
|
||||
#endif // READNAMES_H
|
||||
@@ -1,180 +0,0 @@
|
||||
// Submission-01.cpp : Defines the entry point for the application.
|
||||
//
|
||||
|
||||
#include "main.h"
|
||||
#include "ReadNames.h" // For reading names from file
|
||||
#include "BankAccount.h" // For TBankAccount and EBankAccountType
|
||||
#include "BankAccountList.h" // For TLinkedList
|
||||
#include <string> // For std::getline and std::string
|
||||
#include <iostream> // For std::cout
|
||||
#include <sstream> // For std::istringstream
|
||||
|
||||
|
||||
|
||||
// For statistics
|
||||
typedef struct _TSummary {
|
||||
long comparisonCount = 0;
|
||||
double timeTaken = 0.0;
|
||||
}TSummary;
|
||||
static TSummary statistics;
|
||||
|
||||
|
||||
|
||||
static EBankAccountType getRandomAccountType()
|
||||
{
|
||||
return static_cast<EBankAccountType>(rand() % 5); // Randomly returns one of the 5 account types
|
||||
}
|
||||
|
||||
TLinkedList* bankAccounts = new TLinkedList(true); // List owns the TBankAccount objects
|
||||
TBankAccount** bankAccountArray = nullptr;
|
||||
|
||||
|
||||
static bool OnNameRead(const std::string& firstName, const std::string& lastName)
|
||||
{
|
||||
//For each name read, create from 5 to 10 random bank accounts
|
||||
int accountCount = rand() % 6 + 5; // Random number between 5 and 10
|
||||
for (int i = 0; i < accountCount; i++)
|
||||
{
|
||||
EBankAccountType accType = getRandomAccountType();
|
||||
TBankAccount* newAccount = new TBankAccount(accType, firstName, lastName);
|
||||
bankAccounts->Add(newAccount);
|
||||
}
|
||||
return true; //bankAccounts->getSize() < 100; // For demo purposes
|
||||
}
|
||||
|
||||
static void resetStatistics()
|
||||
{
|
||||
statistics.comparisonCount = 0;
|
||||
statistics.timeTaken = (static_cast<double>(clock())) / CLOCKS_PER_SEC;
|
||||
}
|
||||
|
||||
static void printStastics() {
|
||||
statistics.timeTaken = (static_cast<double>(clock())) / CLOCKS_PER_SEC - statistics.timeTaken;
|
||||
std::cout << "Comparisons: " << statistics.comparisonCount << ", Time taken: " << statistics.timeTaken << " seconds." << std::endl;
|
||||
}
|
||||
|
||||
/*
|
||||
Part 3: Standalone Search Functions (The External Analyst)
|
||||
To simulate working with data from different perspectives, you will also implement search functions that are not part of the list class. These functions will operate on a simple array of pointers.
|
||||
*/
|
||||
|
||||
static TBankAccount* FindAccountByNumber(TBankAccount** accountArray, int arraySize, const std::string& accountNumber) {
|
||||
if (accountArray == nullptr || arraySize <= 0) return nullptr;
|
||||
for (int i = 0; i < arraySize; i++) {
|
||||
statistics.comparisonCount++;
|
||||
if (accountArray[i]->getAccountNumber() == accountNumber) {
|
||||
return accountArray[i]; // Found
|
||||
}
|
||||
}
|
||||
return nullptr; // Not found
|
||||
}
|
||||
|
||||
static void PrintEveryAccountInDateRange(TBankAccount** accountArray, int arraySize, time_t from, time_t to) {
|
||||
if (accountArray == nullptr || arraySize <= 0) return;
|
||||
std::cout << "------------------------------" << std::endl;
|
||||
resetStatistics();
|
||||
int foundCount = 0;
|
||||
for (int i = 0; i < arraySize; i++) {
|
||||
statistics.comparisonCount++;
|
||||
time_t ts = accountArray[i]->getCreationTimestamp();
|
||||
if (ts >= from && ts < to) {
|
||||
std::cout << i + 1 << ". ";
|
||||
accountArray[i]->printAccountInfo();
|
||||
foundCount++;
|
||||
}
|
||||
}
|
||||
printStastics();
|
||||
std::cout << "Total accounts found in date range: " << foundCount << std::endl;
|
||||
}
|
||||
|
||||
|
||||
int main()
|
||||
{
|
||||
std::cout << "--- Submission 4: Sosrt & Search ---" << std::endl;
|
||||
|
||||
// Test TBankAccount
|
||||
//Gen random account type
|
||||
//Change this name for you own names file
|
||||
std::string namesFile = "F:\\IKT203\\VisualStudio\\DATA\\Random_Name.txt";
|
||||
std::cout << "Reading names from file: " << namesFile << std::endl;
|
||||
readNamesFromFile(namesFile, OnNameRead);
|
||||
std::cout << "Total Bank Accounts Created: " << bankAccounts->getSize() << std::endl;
|
||||
std::cout << "Converting linked list to array..." << std::endl;
|
||||
bankAccountArray = bankAccounts->ToArray();
|
||||
std::cout << "Array created with " << bankAccounts->getSize() << " accounts." << std::endl;
|
||||
|
||||
|
||||
resetStatistics();
|
||||
int getRandomIndex = rand() % bankAccounts->getSize();
|
||||
TBankAccount* foundAccount = FindAccountByNumber(bankAccountArray, bankAccounts->getSize(), bankAccountArray[getRandomIndex]->getAccountNumber());
|
||||
if (foundAccount)
|
||||
{
|
||||
std::cout << "Found Account: " << std::endl;
|
||||
foundAccount->printAccountInfo();
|
||||
}
|
||||
else
|
||||
{
|
||||
std::cout << "Account not found." << std::endl;
|
||||
}
|
||||
printStastics();
|
||||
|
||||
resetStatistics();
|
||||
foundAccount = FindAccountByNumber(bankAccountArray, bankAccounts->getSize(), "1234.56.78901");
|
||||
if (foundAccount)
|
||||
{
|
||||
std::cout << "Found Account: " << std::endl;
|
||||
foundAccount->printAccountInfo();
|
||||
}
|
||||
else
|
||||
{
|
||||
std::cout << "Account not found." << std::endl;
|
||||
}
|
||||
printStastics();
|
||||
|
||||
// Find All (Integrated): Use your Every() method to find all accounts created in June 2024 and print their details.
|
||||
resetStatistics();
|
||||
struct June2024Key {
|
||||
time_t start;
|
||||
time_t end;
|
||||
};
|
||||
June2024Key juneKey{};
|
||||
std::tm fromToTm = {};
|
||||
fromToTm.tm_year = 2024 - 1900; // Year since 1900
|
||||
fromToTm.tm_mon = 5; // June (0-based)
|
||||
fromToTm.tm_mday = 1; // 1st
|
||||
fromToTm.tm_hour = 0;
|
||||
fromToTm.tm_min = 0;
|
||||
fromToTm.tm_sec = 0;
|
||||
juneKey.start = _mkgmtime(&fromToTm); // Use _mkgmtime for UTC
|
||||
fromToTm.tm_mday = 30; // 30th
|
||||
fromToTm.tm_hour = 23;
|
||||
fromToTm.tm_min = 59;
|
||||
fromToTm.tm_sec = 59;
|
||||
juneKey.end = _mkgmtime(&fromToTm); // Use _mkgmtime for UTC
|
||||
|
||||
TLinkedList* juneAccounts = bankAccounts->Every(
|
||||
[](TBankAccount* account, void* searchKey) -> bool {
|
||||
June2024Key* key = static_cast<June2024Key*>(searchKey);
|
||||
time_t ts = account->getCreationTimestamp();
|
||||
return ts >= key->start && ts < key->end;
|
||||
}, &juneKey);
|
||||
|
||||
std::cout << "Accounts created in June 2024: " << juneAccounts->getSize() << std::endl;
|
||||
printStastics();
|
||||
|
||||
juneAccounts->forEach(
|
||||
[](TBankAccount* aAccount, int aIndex) {
|
||||
std::cout << aIndex + 1 << ". ";
|
||||
aAccount->printAccountInfo();
|
||||
});
|
||||
|
||||
PrintEveryAccountInDateRange(bankAccountArray, bankAccounts->getSize(), juneKey.start, juneKey.end);
|
||||
|
||||
|
||||
// Cleanup
|
||||
// First delete the array, then the linked list
|
||||
delete[] bankAccountArray;
|
||||
delete bankAccounts;
|
||||
|
||||
return 0;
|
||||
}
|
||||
@@ -1,8 +0,0 @@
|
||||
// Submission-01.h : Include file for standard system include files,
|
||||
// or project specific include files.
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <iostream>
|
||||
|
||||
// TODO: Reference additional headers your program requires here.
|
||||
Reference in New Issue
Block a user