목록문자열 비교 (1)
이우의 개발일지
[C++] 문자열 비교 함수 만들기
문자열 비교 함수 만들기내가 지정한 문자와 입력한 문자가 같으면 종료, 다르면 계속하는 함수 #include #include #include#include using namespace std;const int kMaxstr = 100; // 전역변수 설정 bool IsEqual(const char st1[], const char str2[]) { for (int i = 0; i > str2; if (IsEqual(str1, str2)) { cout ※주의할 점은 bool IsEqual 함수에서 if(st1[i] == str2[i])는 어차피 같으면 넘어가니깐, 굳이 안넣어줘도되는데 처음에 했을 때 안됐던 이유가else if (st1[i] == '\0') return true; else if (st..
Coding/Algorithm
2024. 5. 5. 18:42