일 | 월 | 화 | 수 | 목 | 금 | 토 |
---|---|---|---|---|---|---|
1 | 2 | 3 | 4 | 5 | ||
6 | 7 | 8 | 9 | 10 | 11 | 12 |
13 | 14 | 15 | 16 | 17 | 18 | 19 |
20 | 21 | 22 | 23 | 24 | 25 | 26 |
27 | 28 | 29 | 30 |
Tags
- python
- 파이썬
- object
- suninatas 풀이
- Pwndbg
- xss game
- IF문
- github
- htmlspecialchars
- 김성엽 대표님
- element 조회
- window
- xss game 풀이
- 조건문
- burp suite
- property
- 객체
- document
- lord of sql injection
- 메소드
- 백준 알고리즘
- 사칙연산
- 포인터
- 함수
- 백준 파이썬
- sql injection
- 자바스크립트
- 배열
- blind sql injection
- jQuery
Archives
- Today
- Total
power-girl0-0
[ C++ ] 클래스를 이용하여, 사각형 면적과 둘레 구하기 본문
728x90
#include <iostream>
using namespace std;
class Rectangle{
public:
int width;
int height;
int getArea();
int getdul();
};
int Rectangle::getArea(){
return width*height;
}
int Rectangle::getdul(){
return (width*2)+(height*2);
}
int main(){
Rectangle rect;
rect.width =3;
rect.height = 5;
cout << "사각형의 면적은 "<<rect.getArea()<<endl;
cout << "사각형의 둘레는 "<<rect.getdul()<<endl;
}
728x90
'언어 > C++' 카테고리의 다른 글
[ C++ ] 잔액 구하기 ( 클래스를 이용한 예제 ) (0) | 2021.03.23 |
---|---|
[ C++ ] 생성자와 소멸자를 이용한 예제 (0) | 2021.03.23 |
[ C++ ] 클래스 & 객체 (0) | 2021.03.23 |
[ C++ ] 해밍코드 거리 구하기 (0) | 2021.03.23 |
[ C++ ] 반 평균 구하기 (0) | 2021.03.23 |
Comments