C++ Programming Ch.7 Exercise 5 Solution
Problem: λ€μ main()μμ Color ν΄λμ€λ 3μμ(λΉ¨κ°, μ΄λ‘, νλ)λ‘ νλμ μμ λνλ΄λ ν΄λμ€μ΄λ€(4μ₯ Exercise Problem 1λ² μ°Έκ³ ). μ°μ°μλ‘ μμ λνκ³ , == μ°μ°μλ‘ μμ λΉκ΅νκ³ μ νλ€. Execution Resultλ₯Ό μ°Έκ³ νμ¬ Color ν΄λμ€μ μ°μ°μ, κ·Έλ¦¬κ³ νλ‘κ·Έλ¨μ μμ±νλΌ. 1 2 3 4 5 6 7 8 9 10 11 int main() { Color red(255, 0, 0), blue(0, 0, 255), c; c = red + blue; c.show(); // μ κ° μΆλ ₯ Color fuchsia(255,0,255); if(c == fuchsia) cout << "보λΌμ λ§μ"; else cout << "보λΌμ μλ"; } (1) +μ == μ°μ°μλ₯Ό Color ν΄λμ€μ λ©€λ² ν¨μλ‘ κ΅¬ννλΌ. ...