기타 메모
C++ 메모장 읽기, 쓰기(알고리즘 문제 풀 때 유용)
parkit
2020. 3. 4. 13:15
728x90
반응형
freopen : 읽기
ofstream : 쓰기
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 | #include <bits/stdc++.h> using namespace std; int main() { cin.tie(0); // 읽기(바로 콘솔창으로 바로 입력하게 함) freopen("C:\\Users\\park7\\Desktop\\input.txt", "r", stdin); // 출력값들을 메모장에 쓸 때(파일명으로 생성) ofstream fout; fout.open("C:\\Users\\park7\\Desktop\\output.txt"); fout << "test\n"; fout.close(); return 0; } | cs |
728x90
반응형