Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- # include <iostream>
- using namespace std;
- class line
- {
- int x1;
- int x2;
- int len;
- public:
- friend ostream& operator<< (ostream& out, const line ln);
- friend istream& operator>>(istream& inp, line& ln);
- line(int a);
- };
- ostream& operator<< (ostream& out, const line ln)
- {
- for (int i = 0; i < ln.len; ++i)
- out << "*";
- out << "\n";
- return out;
- }
- istream& operator >> (istream& inp, line& ln)
- {
- inp >> ln.len;
- return inp;
- }
- line::line(int a) {
- len = a;
- x1 = 5;
- x2 = 8;
- }
- int main()
- {
- setlocale(LC_ALL, "Russian");
- cout << "Введите длину линии:\n";
- int l;
- cin >> l;
- line L1(l);
- cin >> L1;
- cout << L1;
- system("pause");
- return 0;
- cin.ignore(); cin.get();
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement