C++ Programming Ch.7 Exercise 9 Solution

Problem: 문제 8번의 Circle 객체에 대해 다음 연산이 가능하도록 연산자를 구현하라. 1 2 3 4 Circle a(5), b(4); b = 1+a; // b의 반지름을 a의 반지름에 1을 더한 것으로 변경 a.show(); b.show(); 2020/03/06 - [C++/명품 C++ programming] - 명품 C++ programming Exercise Problem 7장 8번 [명품 C++ programming Exercise Problem 7장 8번 Problem: 원을 추상화한 Circle 클래스는 간단히 아래와 같다. 1 2 3 4 5 6 class Circle{ int radius; public: Circle(int radius=0) { this->radius = radius; } void show() { cout << "radius = " << radius <<.. ...

March 6, 2020 · 1 min · Sobamemil

C++ Programming Ch.7 Exercise 4 Solution

Problem: 1번 ~ 4번 문제까지 사용될 Book 클래스는 다음과 같습니다. 1 2 3 4 5 6 7 8 9 10 11 12 13 14 class Book{ string title; int price, pages; public: Book(string title="", int price=0, int pages=0){ this->title = title; this->price = price; this->pages = pages; } void show() { cout << title << " " << price << "원 " << pages << " 페이지" << endl; } string getTitle() { return title; } }; 다음 연산을 통해 책의 제목을 사전 순으로 비교하고자 한다. ...

March 6, 2020 · 2 min · Sobamemil