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,69 @@
|
||||
---
|
||||
id: cpp-for-loop
|
||||
title: "C++ For Loop"
|
||||
category: "Programming_Language"
|
||||
status: "draft"
|
||||
verification_status: "conceptual"
|
||||
canonical_id: ""
|
||||
aliases: ["for statement", "three-statement loop", "C++ for 반복문"]
|
||||
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", "loops", "for-loop"]
|
||||
raw_sources: ["https://www.w3schools.com/cpp/cpp_for_loop.asp"]
|
||||
applied_in: []
|
||||
github_commit: ""
|
||||
---
|
||||
|
||||
# [[CPP For Loop]]
|
||||
|
||||
## 🎯 한 줄 통찰 (One-line insight)
|
||||
C++'s `for` loop declares its counter INLINE inside the loop header (`for (int i = 0; i < 5; i++)`) rather than declaring `int i;` separately beforehand — a syntax choice the source demonstrates consistently across every example, meaning `i`'s SCOPE is confined to the loop itself in idiomatic C++ usage, unlike C's tutorial style which more often declared the counter as a separate statement before the loop. [S1]
|
||||
|
||||
## 🧠 핵심 개념 (Core concepts)
|
||||
- **`for (statement1; statement2; statement3) { ... }`** — statement1 runs once before the loop; statement2 is the continuation condition; statement3 runs after each iteration. [S1]
|
||||
- **Inline counter declaration** — `for (int i = 0; ...)` scopes `i` to the loop itself, the idiomatic C++ style shown throughout. [S1]
|
||||
- **Fixed-count use case** — the recommended tool when the number of iterations is known ahead of time. [S1]
|
||||
|
||||
## 📖 세부 내용 (Details)
|
||||
- Basic counting with an inline-declared counter: `for (int i = 0; i < 5; i++) { cout << i << "\n"; }`. [S1]
|
||||
- Accumulating a sum: `int sum = 0; for (int i = 1; i <= 5; i++) { sum = sum + i; } cout << "Sum is " << sum;`. [S1]
|
||||
- Countdown via decrement: `for (int i = 5; i > 0; i--) { cout << i << "\n"; }`. [S1]
|
||||
|
||||
## ⚖️ 모순 및 업데이트 (Contradictions & updates)
|
||||
- **루프 카운터를 for 헤더 안에서 바로 선언**: C 챕터의 예제들은 int i;를 루프 밖에서 별도로 선언하는 경우가 있었지만, C++ 예제는 일관되게 for (int i = 0; ...) 형태로 헤더 안에서 바로 선언해 i의 스코프를 루프에 국한시킨다는 점이 확인됨. [S1]
|
||||
|
||||
## 🛠️ 적용 사례 (Applied in summary)
|
||||
1부터 5까지의 합을 for 루프로 누적 계산하는 예제(sum = sum + i)가 원문에서 직접 실전 활용 사례로 제시됨. [S1]
|
||||
|
||||
## 💻 코드 패턴 (Code patterns)
|
||||
An inline-declared loop counter scoped to the for loop itself (C++):
|
||||
```cpp
|
||||
int sum = 0;
|
||||
for (int i = 1; i <= 5; i++) {
|
||||
sum = sum + i;
|
||||
}
|
||||
cout << "Sum is " << sum;
|
||||
```
|
||||
|
||||
## ✅ 검증 상태 및 신뢰도
|
||||
- **상태:** draft
|
||||
- **검증 단계:** conceptual
|
||||
- **출처 신뢰도:** B (W3Schools — widely used educational reference, not a primary standards body)
|
||||
- **신뢰 점수:** 0.84
|
||||
- **중복 검사 결과:** 신규 생성 (New discovery)
|
||||
|
||||
## 🔗 지식 그래프 (Knowledge Graph)
|
||||
- **상위/루트:** [[C++ Tutorial]]
|
||||
- **관련 개념:** [[CPP Do While Loop]], [[CPP For Loop Foreach]], [[C For Loop]]
|
||||
- **참조 맥락:** for 루프 — foreach 루프(For Loop Foreach) 챕터로 이어짐.
|
||||
|
||||
## 📚 출처 (Sources)
|
||||
- [S1] W3Schools — C++ For Loop — https://www.w3schools.com/cpp/cpp_for_loop.asp
|
||||
|
||||
## 📝 변경 이력 (Change history)
|
||||
- 2026-07-04: Initial draft synthesized from the W3Schools "C++ For Loop" page (Astra wiki-curation, P-Reinforce v3.1 format).
|
||||
Reference in New Issue
Block a user