Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include<iostream>
- using namespace std;
- struct Point
- {
- int x;
- int y;
- void print()
- { // Point* const this
- cout<<"("<< (*this).x <<";"<<y<<")";
- }
- };
- struct Circle
- {
- double r;
- Point p;
- void print() {
- cout << r << " ";
- p.print();
- cout << endl;
- }
- };
- struct Rectangle
- {
- double width;
- double height;
- Point p; //top left
- void print()
- {
- cout<<width<<" "
- <<height<<" ";
- p.print();
- cout<<endl;
- }
- };
- struct Window
- {
- Circle* circles;
- Rectangle* rectangles;
- void print(){
- // for(Circle & c: circles) {
- // c.print();
- // }
- // for(Rectangle & r: rectangles) {
- // r.print();
- // }
- }
- };
- int f() { return 0; }
- struct DynamicArray {
- Circle* circles;
- DynamicArray(unsigned n) {
- circles = new Circle[n];
- }
- ~DynamicArray(){
- delete[] circles;
- }
- };
- int main()
- {
- Point p{5,10};
- Rectangle r{3,4,p};
- Circle c{6,p}; //{6,{5,10}}
- p.print();
- c.print();
- unsigned n;
- cin >> n;
- DynamicArray circlespPP{n};
- Rectangle* rectangles = new Rectangle[n];
- // Window w1{circles, rectangles};
- // Window w2{circles, rectangles};
- // w1.print();
- // cout << endl;
- // w2.print();
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement