Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- using namespace std;
- class box{
- int x, y;
- public:
- box(int i, int j){ i = x; j = y; }
- friend ostream &operator<<(ostream &stream, box o);
- };
- ostream &operator<<(ostream &stream, box o)
- {
- register int i, j;
- for (i = 0; i < o.x; i++)
- stream << "*";
- stream << "n";
- for (j = 1; j < o.y-1; j++){
- for (i = 0; i < o.x; i++)
- if (i == 0 || i == o.x - 1) stream << "*";
- else stream << " ";
- stream << "n";
- }
- for (i = 0; i < o.x; i++)
- stream << "*";
- stream << "n";
- return stream;
- }
- int main(){
- box a(14, 6), b(30, 7), c(40, 5);
- cout << a << b << c;
- return 0;
- }
- box(int i, int j){ i = x; j = y; }
- box( int i, int j ) : x( i ), y( j ) {}
- friend ostream &operator<<(ostream &stream, const box &o);
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement