Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- #include <string>
- using namespace std;
- class Point {
- public:
- int x, y;
- };
- class Triangle {
- public:
- };
- // return_type function_name() {}
- class Rect {
- public:
- void setA(int new_a) {
- if (new_a <= 0) a = 1;
- else a = new_a;
- }
- Rect() {}
- Rect(int x, int y) {
- setA(x);
- setB(y);
- }
- Rect(int length) {
- setA(length);
- setB(length);
- }
- int getA() {
- return a;
- }
- void setB(int new_b) {
- if (new_b <= 0) b = 1;
- else a = new_b;
- }
- int getB() {
- return b;
- }
- Rect enlarge(int new_a, int new_b) {
- int final_a = a + new_a;
- int final_b = b + new_b;
- Rect result;
- result.setA(final_a);
- result.setB(final_b);
- return result;
- }
- private:
- int z;
- int a;
- int b;
- };
- // return_type function_name() {}
- int add(int a, int b, int c) {
- int d = a + b + c;
- string b;
- return d;
- }
- int f() {
- return 5;
- }
- // implicit
- // explicit
- int main() {
- int a, b, c;
- cin >> a >> b >> c;
- add(add(2,5,10),5, 30); // тука ще има някакво сметнато число т.е. 40
- cout << add(a, b, c) << endl;
- f(); // 5
- string z;
- Rect r1(4);
- r1.setA(1);
- r1.setB(1);
- Rect r2();
- r1.setA(2);
- r1.setB(4);
- Rect neshto_si = r1.enlarge(5, 5);
- cout << r1.getA();
- return 0;
- }
Advertisement
Advertisement