Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <fstream>
- #include <cmath>
- using namespace std;
- ifstream in("date.in");
- ofstream out("date.out");
- struct pct{
- char lit;
- int x;
- int y;
- };
- pct x[8];
- int i,j,k;
- int calc(pct a, pct b){
- int f=(a.x-b.x)*(a.x-b.x)+(a.y-b.y)*(a.y-b.y);
- f=sqrt(f);
- return f;
- }
- int main()
- {
- for(i=1;i<=7;i++){ in>>x[i].lit>>x[i].x>>x[i].y; }
- for(i=1;i<=7;i++){
- for(j=i+1;j<=7;j++){
- for(k=j+1;k<=7;k++){
- int c=0, p=0,f=1;
- int l1=calc(x[i],x[j]);
- int l2=calc(x[k],x[j]);
- int l3=calc(x[i],x[k]);
- if(l1==l2) c++;
- if(l2==l3) c++;
- if(l1==l3) c++;
- if(l1*l1==l2*l2+l3*l3) p++;
- if(l2*l2==l1*l1+l3*l3) p++;
- if(l3*l3==l2*l2+l1*l1) p++;
- out<<x[i].lit<<x[j].lit<<x[k].lit<<" este triunghi ";
- if(p&c) out<<"dreptunghic isoscel";
- else if(c==1) out<<"isoscel";
- else if(c==3) out<<"echilateral";
- else if(p) out<<"dreptunghic";
- else out<<"oarecare";
- out<<'\n';
- }
- }
- }
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement