docs(10_Wiki): 위키 구조 정리 — 언어 튜토리얼 카테고리 폴더 제거 + 신규 자산 동기화
Topic_CSS/Topic_HTML/Topic_JavaScript/Topic_Prompt/Topic_Comfyui 등 기존 카테고리 폴더를 정리하고, Topic_Graphic/Dev 등 신규 산출물과 Topics 내부 세션/메모리 기록을 동기화.
This commit is contained in:
@@ -0,0 +1,67 @@
|
||||
---
|
||||
id: cpp-operators-comparison
|
||||
title: "C++ Comparison Operators"
|
||||
category: "Programming_Language"
|
||||
status: "draft"
|
||||
verification_status: "conceptual"
|
||||
canonical_id: ""
|
||||
aliases: ["== != > <", "boolean 1 or 0", "C++ 비교 연산자"]
|
||||
duplicate_of: ""
|
||||
source_trust_level: "B"
|
||||
confidence_score: 0.84
|
||||
created_at: 2026-07-04
|
||||
updated_at: 2026-07-04
|
||||
review_reason: ""
|
||||
merge_history: []
|
||||
tags: ["cpp", "programming-language", "w3schools", "operators", "comparison"]
|
||||
raw_sources: ["https://www.w3schools.com/cpp/cpp_operators_comparison.asp"]
|
||||
applied_in: []
|
||||
github_commit: ""
|
||||
---
|
||||
|
||||
# [[CPP Comparison Operators]]
|
||||
|
||||
## 🎯 한 줄 통찰 (One-line insight)
|
||||
Even though C++ has a genuine `bool` type (unlike C, which needed `<stdbool.h>`), comparison operators STILL return the SAME 1/0 integer convention as C, not a distinct boolean-labeled value — meaning `cout << (x > y)` prints `1`, not `true`, showing that C++'s richer type system didn't change the underlying comparison-result representation inherited from C. [S1]
|
||||
|
||||
## 🧠 핵심 개념 (Core concepts)
|
||||
- **Six comparison operators** — `==`, `!=`, `>`, `<`, `>=`, `<=` — identical set to C. [S1]
|
||||
- **Integer return value** — every comparison returns `1` (true) or `0` (false), printable directly via `cout <<` with no format specifier. [S1]
|
||||
- **Practical decision-making use** — comparisons drive if/else logic (covered in upcoming chapters). [S1]
|
||||
|
||||
## 📖 세부 내용 (Details)
|
||||
- Basic greater-than check: `int x = 5; int y = 3; cout << (x > y); // returns 1 (true)`. [S1]
|
||||
- Voting age eligibility check: `int age = 18; cout << (age >= 18) << "\n"; // 1 (true) cout << (age < 18) << "\n"; // 0 (false)`. [S1]
|
||||
- Password length check: `int passwordLength = 5; cout << (passwordLength >= 8) << "\n"; // 0 (false), too short`. [S1]
|
||||
|
||||
## ⚖️ 모순 및 업데이트 (Contradictions & updates)
|
||||
- **bool 타입이 있어도 비교 결과는 여전히 1/0 정수**: C++가 진짜 bool 타입을 갖췄음에도 비교 연산 결과는 true/false 문자열이 아니라 여전히 1/0 정수로 출력된다는 점이 확인됨 — C의 관례가 그대로 이어짐. [S1]
|
||||
|
||||
## 🛠️ 적용 사례 (Applied in summary)
|
||||
투표 가능 연령 확인(age >= 18)과 비밀번호 길이 확인(passwordLength >= 8)이 원문에서 직접 실전 활용 사례로 제시됨(C 챕터와 동일한 예제). [S1]
|
||||
|
||||
## 💻 코드 패턴 (Code patterns)
|
||||
Comparison operators still returning plain integers (1 or 0), despite C++ having a genuine bool type (C++):
|
||||
```cpp
|
||||
int age = 18;
|
||||
cout << (age >= 18) << "\n"; // 1 (true), old enough to vote
|
||||
cout << (age < 18) << "\n"; // 0 (false)
|
||||
```
|
||||
|
||||
## ✅ 검증 상태 및 신뢰도
|
||||
- **상태:** draft
|
||||
- **검증 단계:** conceptual
|
||||
- **출처 신뢰도:** B (W3Schools — widely used educational reference, not a primary standards body)
|
||||
- **신뢰 점수:** 0.84
|
||||
- **중복 검사 결과:** 신규 생성 (New discovery)
|
||||
|
||||
## 🔗 지식 그래프 (Knowledge Graph)
|
||||
- **상위/루트:** [[C++ Tutorial]]
|
||||
- **관련 개념:** [[CPP Operators Assignment]], [[CPP Operators Logical]], [[CPP Data Types Bool]]
|
||||
- **참조 맥락:** 비교 연산자 — 논리 연산자(Operators Logical) 챕터로 이어짐.
|
||||
|
||||
## 📚 출처 (Sources)
|
||||
- [S1] W3Schools — C++ Comparison Operators — https://www.w3schools.com/cpp/cpp_operators_comparison.asp
|
||||
|
||||
## 📝 변경 이력 (Change history)
|
||||
- 2026-07-04: Initial draft synthesized from the W3Schools "C++ Comparison Operators" page (Astra wiki-curation, P-Reinforce v3.1 format).
|
||||
Reference in New Issue
Block a user