feat: adding the displaytimestemp

This commit is contained in:
Raphael 2024-10-25 15:26:05 +02:00
parent 26f7e39833
commit 223b7ee66c
3 changed files with 49 additions and 12 deletions

View file

@ -6,29 +6,61 @@
/* By: rparodi <rparodi@student.42.fr> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2024/10/23 16:11:46 by rparodi #+# #+# */
/* Updated: 2024/10/23 16:52:20 by rparodi ### ########.fr */
/* Updated: 2024/10/25 14:11:27 by rparodi ### ########.fr */
/* */
/* ************************************************************************** */
#include "Account.hpp"
#include <ctime>
#include <iostream>
Account::Account()
static void _displayTimestamp( void )
{
_nbAccounts = 0;
_totalAmount = 0;
time_t raw_time = time(0);
tm *time = localtime(&raw_time);
std::cout << "[" << time->tm_year + 1900 << "0" << time->tm_mon + 1 << time->tm_mday << "_";
std::cout << time->tm_hour << time->tm_min << time->tm_sec << "] ";
}
/// [19920104_091532] index:0;amount:42;created
Account::Account(int initial_deposit)
{
_nbAccounts += 1;
_totalAmount = initial_deposit;
_totalNbDeposits = 0;
_totalNbWithdrawals = 0;
_displayTimestamp();
std::cout << "index:" << _accountIndex << ";";
std::cout << "amount:" << _totalAmount << ";";
std::cout << "created" << std::endl;
}
static int Account::getNbAccounts()
Account::~Account()
{
t.size();
_accountIndex--;
_displayTimestamp();
std::cout << "index:" << _accountIndex << ";";
std::cout << "amount:" << _totalAmount << ";";
std::cout << "closed" << std::endl;
}
static int Account::getTotalAmount();
int Account::getNbAccounts()
{
return (1);
}
int Account::getTotalAmount();
static int Account::getNbDeposits();
static int Account::getNbWithdrawals();
static void Account::displayAccountsInfos();
/// [19920104_091532] index:2;p_amount:957;deposit:564;amount:1521;nb_deposits:1
static void Account::displayAccountsInfos()
{
_displayTimestamp();
std::cout << "index:" << _accountIndex << ";";
std::cout << "amount:" << _totalAmount << ";";
std::cout << "deposit:" << _totalNbDeposits << ";";
}