#include <iostream>
using namespace std;
int
main(void)
{
double dStranicaA, dStranicaB;
cout<<"Unesite prvu stranicu->";
cin>>dStranicaA;
cout<<"Unesite drugu stranicu->";
cin>>dStranicaB;
if(dStranicaA==dStranicaB)
cout<<"Pravougaonik!"<<endl;
else
cout<<"Kvadrat!"<<endl;
system("PAUSE");
return EXIT_SUCCESS;
}
|
#include <iostream>
using namespace std;
class CPravougaonik
{
private:
double dA, dB;
public:
CPravougaonik( double a=1, double b=1){dA=a; dB=b;}
~CPravougaonik(){}
double StranicaA(void) { return dA;}
double StranicaB(void) { return dB;}
bool
JesteKvadrat(void)
{
return (dA==dB)? false: true;
}
};
int
main(void)
{
double dStranicaA,
dStranicaB;
cout<<"Unesite prvu stranicu->"; cin>>dStranicaA;
cout<<"Unesite drugu stranicu->"; cin>>dStranicaB;
CPravougaonik Pravougaonik(dStranicaA,dStranicaB);
if (Pravougaonik.JesteKvadrat())
cout<<"Pravougaonik!"<<endl;
else
cout<<"Kvadrat!"<<endl;
system("PAUSE");
return EXIT_SUCCESS;
}
|