Need explain fo programm (C++)

Please explain the principle of operation of this program?!

#include <iostream>
using namespace std;

class CRectangle {
int width, height;
public:
CRectangle ();
CRectangle (int,int);
int area (void) {return (width*height);}
};

CRectangle::CRectangle () {
width = 5;
height = 5;
}

CRectangle::CRectangle (int a, int b) {
width = a;
height = b;
}

int main () {
CRectangle rect (3,4);
CRectangle rectb;
cout << "rect area: " << rect.area() << endl;
cout << "rectb area: " << rectb.area() << endl;
system("PAUSE");
return EXIT_SUCCESS;

}


What do YOU think it does???
This programm calculate rect area, but I want to know how the program does this?!
Take it apart.
Do you understand what the default constructor does?
Do you understand what the explicit constructor does?
Do you understand what the area function does?
Do you understand what the cout statements do?
Why you don't answer on my question?
Why don't you try yourself? We don't hold hands here. We will help you, once you show some sort of effort yourself.
You are lazy, you can't write me a simple programm!!! Help me!
Wait, I'm lazy? Because I won't write your program?

Help yourself. I'm done trying to help you.
I wanna help, but it seems like you're demanding rather than asking for help.
so ...
same here
What about demands - I make fun of them! No offense! Today I passed the program on C++, and excellent pass the exam of computer science!
Its fun for you, not for anyone else apparently.

And I do wonder how you passed the program (excellent) without understanding such a basic program like the one you posted.
unless I read your sentence wrong
More advanced version, very usefull!
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
#include <iostream>
#include <cstdlib>
using namespace std;

const int happy=12;
class Main;
class CRectangle {
	private:
		int width, height;
	public:
		CRectangle():width(5),height(5){}
		CRectangle(int a, int b):width(a),height(b){}
		static const int alive=4;
		int area(){return(width*height);}
};
class Main {
	public:
	Main(){}
	static const int horny=8;
	static void fncFooMain(int,char*[]) {
		CRectangle rect(3,4);
		CRectangle rectb;
		cout << "rect area: " << rect.area() << endl;
		cout << "rectb area: " << rectb.area() << endl;
		system("PAUSE");
	}
};
int main (int argc, char* argv[]) {
	Main::fncFooMain(argc,argv);
	(Main::horny | CRectangle::alive) == happy ? cout << "have a nice horse day" << endl : cout << "no luck today" << endl;
	return 0;
}
I'm lucky!
Topic archived. No new replies allowed.