말랑한 하루

VisualStudio에서 더욱 간편하게 백준 사용하기 <bits/stdc++.h> 본문

문제풀이/정보

VisualStudio에서 더욱 간편하게 백준 사용하기 <bits/stdc++.h>

지수는말랑이 2019. 11. 13. 20:53
반응형

백준 문제를 풀면서 반복적으로 헤더를선언하고, 입출력에 대해서 진행하는것이 너무불편했어서

처음시작하거나 잘모르는 사람들에게 알려주고싶은 주관적으로 편한방법입니다.

#include<stdio.h>
#include<string.h>
#include<iostream>
#include<cstdio>
#include<cmath>
#include<math.h>
#include<queue>
#include<vector>
#include<stack>
#include<deque>
#include<string>
#include<algorithm>
#include<cstring>
#include<assert.h>
#include<stdlib.h>
#include<ctime>
#include<map>
#include<set>
#include<bitset>
#include<functional>

// #include <bits/stdc++.h>

디버깅환경에서는 사용자가 임의지정한 여러헤더를 한번에 묶어 선언해놓으면된다.

백준채점프로그램에서 bits/stdc++.h 를 사용하기때문에 저는 bits_stdc++.h 이렇게했어요~

#ifdef _DEBUG
#include "bits_stdc++.h"
#else
#include "bits/stdc++.h"
#endif
#pragma warning(disable:4996)
using namespace std;

int main() {
#ifdef _CONSOLE
	freopen("input.txt", "r", stdin);
#endif
	ios_base::sync_with_stdio(false);
	cin.tie(NULL); cout.tie(NULL);
}

 파일입출력 구문은 위와같이 작성해주고, 리소스파일에 input.txt 텍스트파일을 추가시켜 사용하면 됩니다.

 

살짝 귀찮은부분은 cpp를 새로생성할때마다 cpp 파일 속성(Properties)에 들어가서
C/C++ -> 전처리기 -> 전처리기정의 -> _DEBUG/_CONSOLE 을 작성해주어야한다는것.

반응형

'문제풀이 > 정보' 카테고리의 다른 글

자주 쓰는 SQL 함수  (0) 2022.07.22
Comments