Not finished, but no more time for improvements
This commit is contained in:
@@ -101,6 +101,6 @@ typedef bool (*FSongRead)(
|
||||
void ReadSongsFromFile(const std::string& aFilename, FSongRead aOnSongRead);
|
||||
|
||||
|
||||
|
||||
void PrintList(TLinkedList* list);
|
||||
|
||||
#endif // SHARED_LIB_H
|
||||
|
||||
@@ -1,4 +1,18 @@
|
||||
#include <bits/stl_tree.h>
|
||||
|
||||
#include "SharedLib.h"
|
||||
int g_printIndex = 0;
|
||||
|
||||
static void PrintAccCallback(TBankAccount* acc, int /*i*/)
|
||||
{
|
||||
std::cout << g_printIndex++ << ": " << acc->ownerFirstName << " " << acc->ownerLastName
|
||||
<< " | Balance: " << acc->getBalance() << std::endl;
|
||||
}
|
||||
|
||||
void PrintList(TLinkedList* list)
|
||||
{
|
||||
if (!list)
|
||||
return;
|
||||
g_printIndex = 0;
|
||||
list->forEach(PrintAccCallback);
|
||||
}
|
||||
@@ -1,5 +1,6 @@
|
||||
#include "main.h"
|
||||
#include "SharedLib.h"
|
||||
#include "Sort.h"
|
||||
|
||||
|
||||
static TLinkedList g_list(false);
|
||||
@@ -7,7 +8,7 @@ static std::vector<TBankAccount*> g_array;
|
||||
|
||||
static bool onNameRead(const int idx, const int total, const std::string& first, const std::string& last)
|
||||
{
|
||||
auto* acc = new TBankAccount(EBankAccountType::Checking, first, last);
|
||||
auto* acc = new TBankAccount(Checking, first, last);
|
||||
|
||||
g_list.Append(acc);
|
||||
g_array.push_back(acc);
|
||||
@@ -19,6 +20,7 @@ int main()
|
||||
readNamesFromFile("random_names.txt", onNameRead);
|
||||
|
||||
Sort sorter(g_array.data(), (int)g_array.size(), &g_list);
|
||||
PrintList(&g_list);
|
||||
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user