Advertisement
Guest User

Untitled

a guest
Jan 17th, 2018
68
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.50 KB | None | 0 0
  1. #include <iostream>
  2. using namespace std;
  3. class Rectangle {
  4. int width, height;
  5. public:
  6. void set (int,int);
  7. int area () {return (width*height);}
  8. };
  9. void Rectangle::set (int a, int b) {
  10. width = a;
  11. height = b;
  12. }
  13. int main () {
  14. Rectangle rect[100];
  15. int n, x ,y;
  16. cout<<"n=";cin>>n;
  17. for(int i=0;i<n;i++){
  18. cout<<"x=";cin>>x;
  19. cout<<" y=";cin>>y;
  20. rect[i].set(x, y);
  21. cout<<rect[i].area()<<endl;;
  22. }
  23. return 0;
  24. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement