| #include<iostream> using namespace std; class Rectangle { private: int width, height, area; public: Rectangle(int w=5, int h=10) {width=w; height=h;} void setRectangle(int w, int h) {width=w; height=h;} void calcArea(){area=width*height;} int getArea(){return area;} void print(); }; void Rectangle::print() { cout<<"가로 : "<< width << ",세로 : " << height << ",넓이" << area <<endl; } void main() { Rectangle r; r.calcArea(); r.print(); } |
| 번호 | 분류 | 제목 |
|---|---|---|
| 28 | C언어 |
원의 넓이
|
| 27 | C언어 |
원넓이 버전투
|
| 26 | C언어 |
ver3
|
| 25 | C언어 |
각 자리의수 합 구하기 예제
|
| 24 | C언어 |
두 숫자 사이의 짝수 출력
|
| 23 | C언어 |
예제4 5명의 평균 구하기
|
| 22 | C언어 |
예제4(Ver.2)
|
| 21 | C언어 |
ex1
|
| 20 | C언어 |
3-28
|
| » | C언어 | Rectangle |
| 18 | C언어 | Rectangle2 |
| 17 | C언어 | Rectangle3 |
| 16 | C언어 | Rectangle4 |
| 15 | C언어 |
Rectangle 객체배열
|
| 14 | C언어 | 동적메모리 |