C++ Programming Ch.11 Exercise 3 Solution
Problem: ν μ€μ 'μμ΄λ¬Έμ₯;νκΈλ¬Έμ' νμμΌλ‘ ν€ μ λ ₯λ λ, cin.ignore()λ₯Ό μ΄μ©νμ¬ ';' μ΄νμ μ λ ₯λ λ¬Έμμ΄μ νλ©΄μ μΆλ ₯νλ νλ‘κ·Έλ¨μ μμ±νλΌ. μλμμ ^Z(ctrl-z) ν€λ μ λ ₯ μ’ λ£λ λνλ΄λ ν€μ΄λ©°, cin.get()μ EOFλ₯Ό 리ν΄νλ€. Execution Result: Objective & Hints: cin.get(), EOF, cin.ignore() νμ© Code: 1 2 3 4 5 6 7 8 9 10 11 12 #include using namespace std; int main() { int ch; cin.ignore(100, ';'); // μμ΄ λ¬Έμ₯μ΄ μ΅λ 99κ°μ λ¬Έμλ‘ μ λ ₯λλ€κ³ κ°μ νλ€. while((ch=cin.get()) != EOF) { cout.put(ch); if(ch == '\n') cin.ignore(100, ';'); // μμ΄ λ¬Έμ₯μ΄ μ΅λ 99κ°μ λ¬Έμλ‘ μ λ ₯λλ€κ³ κ°μ νλ€. } } Explanation: ...