ComputerScience/C-C++(6)
-
[gcc/g++] long double operate error 2021.10.01
-
vector 선언,초기화와 정적 배열 초기화 속도차이
#include #include #include using namespace std; class ChronoTimer { private: chrono::time_point s, e; public: void start() { s = chrono::steady_clock::now(); } void stop() { e = chrono::steady_clock::now(); } long long getNano() { return chrono::nanoseconds(e - s).count(); } void stopNPrint() { stop();cout
2019.09.30 -
자잘한 문법들
if(initialize;condition){ ... } ///////////////////////////// switch(initialize;condition) case... C++17에서 추가된 문법 int x{}; float y{}; ... cout
2019.07.25 -
C++17 Structured binding
tuple t = {"lee", 'Y', 12}; auto [name,check,age] = t; // string name = lee, char check = Y, int age = 12 pair p = {1,2}; auto [x,y] = p; // int x= 1, int y =2 너무 편해버림 tuple이나 구조체로부터 여러 변수를 동시해 초기화 tuple t = {1.2, 6, 30} auto &[a,b,c] = t; // double &a = 1.2, int &b=6, int &c = 30 a = 1.3 cout
2019.07.25 -
문자열(string)으로 입력받기, 문자열 쪼개기::string stream
sstream = string + stream ios,iostream의 함수들을 상속받아 사용가능 (>>, > s; cout k) { cout n) { cout
2019.07.09 -
클래스 템플릿// 멤버함수의 외부 선언
클래스 템플릿(Class template)의 멤버 함수를 외부에 선언할 때 다음과 같이 작성한다. 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 //classA.h header file template class A { . . . void function(T data){ . . } . . }; //클래스 내부 선언 ---------------------------------------------------------- template class A { . . . void function(T); . . }; template void A::function(T data){ . . }//외부선언 Colored by Color..
2019.05.12