Notice
Recent Posts
Recent Comments
Link
빙수달 게임 개발 노트
[C++] 삼각형 넓이 구하기 본문
#include <iostream>
#include <cmath>
using namespace std;
double triangle(double a, double b, double c, double d, double e, double f);
int main(void)
{
double a = 0, b = 0;
double c = 0, d = 0;
double e = 0, f = 0;
cin >> a; cin >> b;
cin >> c; cin >> d;
cin >> e; cin >> f;
cout << "(" << a << "," << b << "), (" << c << "," << d << "), (" << e << "," << f<<")가 이루는 삼각형 면적은?\n" << endl;
cout << "삼각형의 면적 : " << double(abs(triangle(a, b, c, d, e, f))/2);
return 0;
}
double triangle(double a, double b, double c, double d, double e, double f)
{
double area = (a*d + c*f + e*b-b*c-e*d-a*f);
return area;
}

'Programming > C++' 카테고리의 다른 글
| [C++] 'Done' 입력 때까지 총 단어 수 (1) | 2024.12.15 |
|---|---|
| [C++] 자동차 데이터 관리 (1) | 2024.12.15 |
| [C++] 두 점 사이의 거리 구하기 (0) | 2024.12.15 |
| [C++] 비행기 최소 활주 길이 (0) | 2024.12.15 |
| [C++] TCL 사의 피자 분석 서비스 (0) | 2024.12.15 |