C++ Programming Ch.11 Exercise 1 Solution
Problem: int cin.get() ํจ์๋ฅผ ์ด์ฉํ์ฌ ํค๋ณด๋๋ก๋ถํฐ ํ ๋ผ์ธ์ ์ฝ๊ณ 'a'๊ฐ ๋ช ๊ฐ์ธ์ง ์ถ๋ ฅํ๋ ํ๋ก๊ทธ๋จ์ ์์ฑํ๋ผ. Execution Result: Objective & Hints: cin์ผ๋ก ํค ์ ๋ ฅ ์ฐ์ต Code: 1 2 3 4 5 6 7 8 9 10 11 12 13 14 #include using namespace std; int main() { int a; int cnt=0; while( (a = cin.get() ) != EOF ){ if(a == 'a') cnt++; else if(a == '\n') break; } cout << cnt; } Explanation: ...