C++

C++ - cin의 입력이 없을 시 종료

마루설아 2025. 1. 19. 15:47
while (true) {
    cin >> num;

    if (cin.eof()) return 0;
    
    ...
}


// or

while (cin >> num) {
	...
}

'C++' 카테고리의 다른 글

C++ - 구간합 이론  (0) 2025.03.04
C++ - bits/stdc++.h 헤더파일에서 unordered_map & set 등 사용하기  (0) 2025.01.22
C++ - map 요소 접근 방법  (0) 2025.01.16
C++ - lower_bound & upper_bound  (0) 2025.01.11
C++ 대소문자 변환  (0) 2025.01.10