C++ Programming Ch.2 Exercise 7 Solution
Problem: ๋ค์๊ณผ ๊ฐ์ด "yes"๊ฐ ์ ๋ ฅ๋ ๋๊น์ง ์ข ๋ฃํ์ง ์๋ ํ๋ก๊ทธ๋จ์ ์์ฑํ๋ผ. ์ฌ์ฉ์๋ก๋ถํฐ์ ์ ๋ ฅ์ cin.getline() ํจ์๋ฅผ ์ฌ์ฉํ๋ผ. Objective & Hints: ๊ณต๋ฐฑ์ ํฌํจํ๋ ๋ฌธ์์ด ์ฝ๊ธฐ Execution Result: Code: 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 #include #include using namespace std; int main() { char A[] = "yes"; // ๋ฐฐ์ด ์ ์ธ์ "yes"๋ก ์ด๊ธฐํ char B[100]; while(true){ cout << "์ข ๋ฃํ๊ณ ์ถ์ผ๋ฉด yes๋ฅผ ์ ๋ ฅํ์ธ์>>"; cin.getline(B,100); if(strcmp(A,B) == 0) break; } cout << "์ข ๋ฃํฉ๋๋ค..."; return 0; } Explanation: ...