Hãy luôn nhớ cảm ơn và vote 5*
nếu câu trả lời hữu ích nhé!
#include <bits/stdc++.h>
using namespace std;
float khoangcach(int x1, int y1, int x2, int y2) {
float a=sqrt((x2-x1)*(x2-x1)+(y2-y1)*(y2-y1));
return a;
}
int main()
{
int ax,ay,bx,by,cx,cy;
cout << "Diem thu 1: ";
cin >> ax >> ay;
cout << "Diem thu 2: ";
cin >> bx >> by;
cout << "Diem thu 3: ";
cin >> cx >> cy;
float x=khoangcach(ax,ay,bx,by);
float y=khoangcach(bx,by,cx,cy);
float z=khoangcach(ax,ay,cx,cy);
if (x>=y && x>=z) {
float o1=(ax+bx)/2;
float o2=(ay+by)/2;
cout << float(o1*2-cx) << " " << float(o2*2-cy);
return 0;
}
if (y>=x && y>=z) {
float o1=(bx+cx)/2;
float o2=(by+cy)/2;
cout << float(o1*2-ax) << " " << float(o2*2-ay);
return 0;
}
if (z>=y && z>=x) {
float o1=(ax+cx)/2;
float o2=(ay+cy)/2;
cout << float(o1*2-bx) << " " << float(o2*2-by);
return 0;
}
}
Hãy giúp mọi người biết câu trả lời này thế nào?
#include <iostream>
using namespace std;
int main() {
double x1, y1, x2, y2, x3, y3, x4, y4;
cin >> x1 >> y1;
cin >> x2 >> y2;
cin >> x3 >> y3;
if (x1 == x2) x4 = x3; else
if (x1 == x3) x4 = x2; else
if (x2 == x3) x4 = x1;
if (y1 == y2) y4 = y3; else
if (y1 == y3) y4 = y2; else
if (y2 == y3) y4 = y1;
cout << x4 << " " << y4;
}
Hãy giúp mọi người biết câu trả lời này thế nào?
Bảng tin