| #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(); } |
-
원의 넓이
-
원넓이 버전투
-
ver3
-
각 자리의수 합 구하기 예제
-
두 숫자 사이의 짝수 출력
-
예제4 5명의 평균 구하기
-
예제4(Ver.2)
-
ex1
-
3-28
-
Rectangle
-
Rectangle2
-
Rectangle3
-
Rectangle4
-
Rectangle 객체배열
-
동적메모리