Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- using namespace std;
- class Rectangle {
- int width, height;
- public:
- void set (int,int);
- int area () {return (width*height);}
- };
- void Rectangle::set (int a, int b) {
- width = a;
- height = b;
- }
- int main () {
- Rectangle rect[100];
- int n, x ,y;
- cout<<"n=";cin>>n;
- for(int i=0;i<n;i++){
- cout<<"x=";cin>>x;
- cout<<" y=";cin>>y;
- rect[i].set(x, y);
- cout<<rect[i].area()<<endl;;
- }
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement