feat: adding the displaytimestemp
This commit is contained in:
parent
26f7e39833
commit
223b7ee66c
3 changed files with 49 additions and 12 deletions
|
|
@ -1,8 +1,13 @@
|
||||||
CompileFlags:
|
CompileFlags:
|
||||||
Compiler: clang
|
Compiler: clang++
|
||||||
Add:
|
Add:
|
||||||
- "-xc++"
|
- "-xc++"
|
||||||
|
- "-std=c++98"
|
||||||
|
- "-Werror"
|
||||||
|
- "-Wextra"
|
||||||
|
- "-Wall"
|
||||||
|
- "-stdlib=libc++"
|
||||||
- "-I/usr/local/include"
|
- "-I/usr/local/include"
|
||||||
- "-I/nix/store/pzmpyb9hxfv60vh0l67avr94h71nip1b-llvm-16.0.6-dev/include"
|
- "-I/nix/store/pzmpyb9hxfv60vh0l67avr94h71nip1b-llvm-16.0.6-dev/include"
|
||||||
- "-I/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/include"
|
- "-I/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/include"
|
||||||
- "-I/Users/raphael/Documents/piscine/cpp/cpp00/ex01/includes/"
|
- "-I/Users/raphael/Documents/42_cursus/circle4/cpp/cpp00/ex02"
|
||||||
|
|
|
||||||
|
|
@ -6,29 +6,61 @@
|
||||||
/* By: rparodi <rparodi@student.42.fr> +#+ +:+ +#+ */
|
/* By: rparodi <rparodi@student.42.fr> +#+ +:+ +#+ */
|
||||||
/* +#+#+#+#+#+ +#+ */
|
/* +#+#+#+#+#+ +#+ */
|
||||||
/* Created: 2024/10/23 16:11:46 by rparodi #+# #+# */
|
/* 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 "Account.hpp"
|
||||||
|
#include <ctime>
|
||||||
|
#include <iostream>
|
||||||
|
|
||||||
Account::Account()
|
static void _displayTimestamp( void )
|
||||||
{
|
{
|
||||||
_nbAccounts = 0;
|
time_t raw_time = time(0);
|
||||||
_totalAmount = 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;
|
_totalNbDeposits = 0;
|
||||||
_totalNbWithdrawals = 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::getNbDeposits();
|
||||||
|
|
||||||
static int Account::getNbWithdrawals();
|
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 << ";";
|
||||||
|
}
|
||||||
|
|
|
||||||
|
|
@ -1,12 +1,12 @@
|
||||||
# **************************************************************************** #
|
# **************************************************************************** #
|
||||||
# #
|
|
||||||
# ::: :::::::: #
|
# ::: :::::::: #
|
||||||
# Makefile :+: :+: :+: #
|
# Makefile :+: :+: :+: #
|
||||||
# +:+ +:+ +:+ #
|
# +:+ +:+ +:+ #
|
||||||
# By: rparodi <rparodi@student.42.fr> +#+ +:+ +#+ #
|
# By: rparodi <rparodi@student.42.fr> +#+ +:+ +#+ #
|
||||||
# +#+#+#+#+#+ +#+ #
|
# +#+#+#+#+#+ +#+ #
|
||||||
# Created: 2023/11/12 11:05:05 by rparodi #+# #+# #
|
# Created: 2023/11/12 11:05:05 by rparodi #+# #+# #
|
||||||
# Updated: 2024/10/23 16:47:57 by rparodi ### ########.fr #
|
# Updated: 2024/10/25 13:20:21 by rparodi ### ########.fr #
|
||||||
# #
|
# #
|
||||||
# **************************************************************************** #
|
# **************************************************************************** #
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue