tmp.c/main.cpp
Vincent Batts 78660fb70e
main: and remembered to delete the variable from heap ...
Signed-off-by: Vincent Batts <vbatts@hashbangbash.com>
2025-02-10 16:54:15 -05:00

60 lines
1.3 KiB
C++

/*
* =====================================================================================
*
* Filename: main.cpp
*
* Description: learning C++ [again]
*
* Version: 1.0
* Created: 02/08/2025 11:05:02 AM
* Revision: none
* Compiler: g++
*
* Author: Vincent Batts (vbatts@hashbangbash.com)
* Organization: HashBangBash
*
* =====================================================================================
*/
#include <iostream>
#include <cmath>
#include <cstdlib>
#include "common.h"
#include "account.h"
#include "worker.h"
Account* do_account() {
Account* account = new Account(0.0);
account->deposit(100.5); // Add some money
account->deposit(50.25); // Add more money
log_out("Current Balance: " << account->getBalance());
return account;
}
void scoped_account() {
log_out("HERE");
auto account = do_account();
log_out("HERE");
account->withdraw(100);
log_out("Current Balance: " << account->getBalance());
log_err("dang");
delete account;
}
int main(int argc, char* argv[]) {
int ret;
scoped_account();
Dang::Worker worker;
ret = worker.work();
if (ret != 0) {
std::cout << "worker failed" << std::endl;
}
return EXIT_SUCCESS;
}
// vim:set sts=2 sw=2 et: