Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- using namespace std;
- const float pi = 3.14;
- class Krug {
- private:
- float rad;
- public:
- Krug () {
- this->rad = 0;
- }
- Krug(int radius) {
- this->rad = radius;
- }
- float perimetar();
- float plostina();
- int ednakvi();
- };
- float Krug::perimetar() {
- return 2*rad*pi;
- }
- float Krug::plostina() {
- return rad*rad*pi;
- }
- int Krug::ednakvi() {
- if(plostina()==perimetar())
- return 1;
- else
- return 0;
- }
- int main() {
- float r;
- cin >> r;
- //instanciraj objekt od klasata Krug cij radius e vrednosta procitana od tastatura
- Krug k(r);
- cout << k.perimetar() << endl;
- cout << k.plostina() << endl;
- cout << k.ednakvi() << endl;
- //instanciraj objekt od klasata Krug cij radius ne e definiran
- Krug k2;
- return 0;
- }
Add Comment
Please, Sign In to add comment