dreptunghi.cpp

using namespace std; struct Dreptunghi
 * 1) include
 * 2) include
 * 3) include

{ float a,b;} x,y; void citire_dreptunghi(Dreptunghi &d) { cout<<"Lungimea="; cin>>d.a; cout<<"Latimea="; cin>>d.b; } float perimetru(Dreptunghi d) { return 2*d.a+2*d.b;} float arie(Dreptunghi d) {return d.a*d.b;} float diagonala(Dreptunghi d) { return sqrt(d.a*d.a+d.b*d.b); } int main

{

cout<<"dreptunghiul x"<<endl; citire_dreptunghi(x);

cout<<"dreptunghiul y"<<endl; citire_dreptunghi(y);

cout<<"Aria="<<arie(x)<<endl;

cout<<"Perimetru="<<perimetru(x)<<endl;

cout<<"Diagonala="<<setprecision(8)<<diagonala(x)<<endl;

if(x.a==x.b) cout<<"x este patrat"<<endl; else cout<<"x nu este patrat"<<endl;

if(arie(x)==arie(y)) cout<<"x si y au aceeasi arie"<<endl; else cout<<"x si y nu au aceeasi arie"<<endl;

if(perimetru(x)==perimetru(y)) cout<<"x si y au acelasi perimetru"<<endl; else cout<<"x si y nu au acelasi perimetru"<<endl;

if(diagonala(x)==diagonala(y)) cout<<"x si y au aceeasi diagonala"<<endl; else cout<<"x si y nu au aceeasi diagonala"<<endl;

return 0; }