e9cbf23ab5
이전 재구성 작업에서 Dev/ 폴더가 누락되었던 것을 반영. - Dev/Topic_Programming(중첩 폴더, 78개)은 Dev 자체 최상위 폴더들 (Architecture/Conventions/Engineering_Intelligence 등)과 완전 중복이라 제거. - Dev 최상위 엔지니어링 지식 폴더(Architecture/Conventions/Engineering_Intelligence/ Failure_Library/Generalized_Principles/Language/Pattern_Catalog/Platform_Guides/ Subsystems, 77개)는 이미 Topic_Programming/Topic_Programming에 더 최신 버전이 존재해 중복 제거(고유 콘텐츠 1개는 예외 처리하여 이동 보존). - Dev의 W3Schools 언어 튜토리얼 폴더(Topic_C/CPP/CSS/CSharp/HOWTO/HTML/Java/ JavaScript/PHP/Python/SQL/W3CSS, 1201개)는 전부 Topic_Programming 하위로 이동. - 에이전트 운영 상태(.astra/docs)는 그대로 유지, 콘텐츠 폴더만 정리. - Topic_Programming 최종 문서 수: 2784 → 3985.
3.5 KiB
3.5 KiB
id, title, category, status, verification_status, canonical_id, aliases, duplicate_of, source_trust_level, confidence_score, created_at, updated_at, review_reason, merge_history, tags, raw_sources, applied_in, github_commit
| id | title | category | status | verification_status | canonical_id | aliases | duplicate_of | source_trust_level | confidence_score | created_at | updated_at | review_reason | merge_history | tags | raw_sources | applied_in | github_commit | ||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| cpp-strings-input | C++ User Input Strings | Programming_Language | draft | conceptual |
|
B | 0.86 | 2026-07-04 | 2026-07-04 |
|
|
CPP User Input Strings
🎯 한 줄 통찰 (One-line insight)
cin >> has the EXACT SAME whitespace-termination limitation as C's scanf("%s", ...) — typing "John Doe" only captures "John" — and C++'s fix (getline(cin, fullName)) mirrors C's fgets() fix conceptually, both existing specifically to read a full line including spaces, meaning this particular parsing limitation and its solution transferred from C to C++ despite the completely different I/O syntax (>>/cin versus scanf/format-strings). [S1]
🧠 핵심 개념 (Core concepts)
cin >> variable— the extraction operator, reads user input into a variable. [S1]cin's whitespace-termination limitation — treats spaces as a terminator, so it can only capture a SINGLE WORD even if the user types multiple words. [S1]getline(cin, variable)— reads a FULL LINE of text including spaces; takescinas the first parameter and the target string as the second. [S1]
📖 세부 내용 (Details)
- Basic single-word input:
string firstName; cin >> firstName;. [S1] - The space-termination trap demonstrated:
string fullName; cin >> fullName; // "John Doe" typed → only "John" stored. [S1] - The
getline()fix for multi-word input:string fullName; getline (cin, fullName); // "John Doe" typed → "John Doe" stored in full. [S1]
⚖️ 모순 및 업데이트 (Contradictions & updates)
- cin >>은 공백에서 끊김: "John Doe"를 입력해도 공백을 종료 문자로 취급해 "John"만 저장된다는 점이 C의 scanf("%s") 문제와 동일하게 확인되며, getline()이 fgets()와 동일한 역할의 해결책으로 제시됨. [S1]
🛠️ 적용 사례 (Applied in summary)
사용자의 전체 이름(공백 포함)을 정확히 입력받기 위해 cin >> 대신 getline()을 사용하는 예제가 원문에서 직접 실전 활용 사례로 제시됨. [S1]
💻 코드 패턴 (Code patterns)
Reading a full line of text (including spaces) with getline() instead of cin >> (C++):
string fullName;
cout << "Type your full name: ";
getline(cin, fullName);
cout << "Your name is: " << fullName; // "John Doe" prints in full
✅ 검증 상태 및 신뢰도
- 상태: draft
- 검증 단계: conceptual
- 출처 신뢰도: B (W3Schools — widely used educational reference, not a primary standards body)
- 신뢰 점수: 0.86
- 중복 검사 결과: 신규 생성 (New discovery)
🔗 지식 그래프 (Knowledge Graph)
- 상위/루트: C++ Tutorial
- 관련 개념: CPP Strings Esc, CPP Strings Length, C User Input
- 참조 맥락: 사용자 입력 문자열 — 문자열 길이(Strings Length) 챕터로 이어짐.
📚 출처 (Sources)
- [S1] W3Schools — C++ User Input Strings — https://www.w3schools.com/cpp/cpp_strings_input.asp
📝 변경 이력 (Change history)
- 2026-07-04: Initial draft synthesized from the W3Schools "C++ User Input Strings" page (Astra wiki-curation, P-Reinforce v3.1 format).