// ?
// ?
// [19920104_091532] // YYYYMMDD_HHMMSS 꼴임
#include <ctime> // Timestamp 관련 함수들
#include <iostream>
int main()
{
char buf[18];
time_t curtime;
struct tm *timeinfo;
time(&curtime);
timeinfo = localtime(&curtime);
strftime(buf, 18, "[%Y%m%d_%H%M%S]",timeinfo);
std::cout << buf << ' ' ;
}
>> [20220609_172703]
1)time_t time(time_t *seconds)
2) struct tm *locatltime(const time_t *timer)
struct tm
{
int tm_sec; // 초, range 0 to 59
int tm_min; // 분, range 0 to 59
int tm_hour; // 시간, range 0 to 23
int tm_mday; // 일, range 1 to 31
int tm_mon; // 월, range 0 to 11
int tm_year; // 1900년 부터의 년
int tm_wday; // 요일, range 일(0) to 토(6)
int tm_yday; // 1년 중 경과 일, range 0 to 365
int tm_isdst; // 섬머타임 실시 여부 (양수, 0, 음수)
};
3) size_t strftime(char *ptr, size_t maxsize, const char *format, const struct tm *timeptr)
표준 템플릿 라이브러리라고 불리는 STL(Standard Template Libaray)은 자료구조와 알고리즘을 효율적으로 관리할 수 있도록 C++ 에서 제공 하는 표준 라이브러리
-> 추후 알고리즘 풀면서 더 파볼 예정
클래스를 0~7순으로 객체를 추가했을때 소멸시 OS에 따라 0~7 로 소멸 될수 있고 7~0 으로 소멸 될수 있다.
MacOS -> 7~0 ,역순으로 소멸
ubuntu -> 0~7 로 소멸
다른 이유는 std::vector 또는 클래스 의 소멸자 구현이 시스템마다 다르기 때문이다.
#ifndef #endif
vs #pragma once
/// 결론 2개 같이 쓰면 어떻게 되나??
가져온곳:
https://kldp.org/node/46662
https://docs.microsoft.com/ko-kr/cpp/preprocessor/once?view=msvc-170
[19920104_091532] index:0;amount:42;created
[19920104_091532] index:1;amount:54;created
[19920104_091532] index:2;amount:957;created
[19920104_091532] index:3;amount:432;created
[19920104_091532] index:4;amount:1234;created
[19920104_091532] index:5;amount:0;created
[19920104_091532] index:6;amount:754;created
[19920104_091532] index:7;amount:16576;created
[19920104_091532] accounts:8;total:20049;deposits:0;withdrawals:0
[19920104_091532] index:0;amount:42;deposits:0;withdrawals:0
[19920104_091532] index:1;amount:54;deposits:0;withdrawals:0
[19920104_091532] index:2;amount:957;deposits:0;withdrawals:0
[19920104_091532] index:3;amount:432;deposits:0;withdrawals:0
[19920104_091532] index:4;amount:1234;deposits:0;withdrawals:0
[19920104_091532] index:5;amount:0;deposits:0;withdrawals:0
[19920104_091532]
```c
index:6;amount:754;deposits:0;withdrawals:0
[19920104_091532] index:7;amount:16576;deposits:0;withdrawals:0
[19920104_091532] index:7;amount:16576;deposits:0;withdrawals:0
[19920104_091532] index:0;p_amount:42;deposit:5;amount:47;nb_deposits:1
[19920104_091532] index:1;p_amount:54;deposit:765;amount:819;nb_deposits:1
[19920104_091532] index:2;p_amount:957;deposit:564;amount:1521;nb_deposits:1
[19920104_091532] index:3;p_amount:432;deposit:2;amount:434;nb_deposits:1
[19920104_091532] index:4;p_amount:1234;deposit:87;amount:1321;nb_deposits:1
[19920104_091532] index:5;p_amount:0;deposit:23;amount:23;nb_deposits:1
[19920104_091532] index:6;p_amount:754;deposit:9;amount:763;nb_deposits:1
[19920104_091532] index:7;p_amount:16576;deposit:20;amount:16596;nb_deposits:1
[19920104_091532] index:0;p_amount:47;withdrawal:refused
[19920104_091532] index:1;p_amount:819;withdrawal:34;amount:785;nb_withdrawals:1
[19920104_091532] index:2;p_amount:1521;withdrawal:657;amount:864;nb_withdrawals:1
[19920104_091532] index:3;p_amount:434;withdrawal:4;amount:430;nb_withdrawals:1
[19920104_091532] index:4;p_amount:1321;withdrawal:76;amount:1245;nb_withdrawals:1
[19920104_091532] index:5;p_amount:23;withdrawal:refused
[19920104_091532] index:6;p_amount:763;withdrawal:657;amount:106;nb_withdrawals:1
[19920104_091532] index:7;p_amount:16596;withdrawal:7654;amount:8942;nb_withdrawals:1
[19920104_091532] index:0;amount:47;closed
[19920104_091532] index:1;amount:785;closed
[19920104_091532] index:2;amount:864;closed
[19920104_091532] index:3;amount:430;closed
[19920104_091532] index:4;amount:1245;closed
[19920104_091532] index:5;amount:23;closed
[19920104_091532] index:6;amount:106;closed
[19920104_091532] index:7;amount:8942;closed