목록C | C++ (3)
main
[C++] 문자열 소문자-대문자 변환
* 아스키 코드를 사용한다. * 대문자 - 소문자 간에 아스키 코드 10진수 값 차이가 32 임. 대문자 -> 소문자 for (auto &item : str) { if ('A'
C | C++
2022. 1. 30. 23:31
[C ++] 문자열 공백 제거
코드 #include #include #include using namespace std; int main(void) { string str = "str ing"; str.erase(remove(str.begin(), str.end(), ' '), str.end()); cout
C | C++
2022. 1. 30. 23:13
[C++] warning C4804: '>': unsafe use of type 'bool' in operation
에러 warning C4804: '>': unsafe use of type 'bool' in operation 원인 // 잘못된 문법이다. if(a < x < b) // 사실상 아래와 같다. if((a < x) < b) // 즉 boolean < b 의 형태이므로 error 발생한다. if (boolean < b) 해결방법 // 아래와 같이 작성한다. and operator(&&) 사용 if(a < x && x < b) [참고 자료] https://stackoverflow.com/questions/42552877/why-the-warning-c4804-unsafe-use-of-type-bool-in-operation-is-popping
C | C++
2022. 1. 30. 22:58