Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- // Points.cpp : Defines the entry point for the console application.
- // Ćwiczenia str. 349
- #include "stdafx.h"
- #include "../../../../std_lib_facilities.h"
- struct Point {
- int x;
- int y;
- Point()
- :x(0), y(0) {}
- };
- ifstream& operator>>(ifstream& ist, Point& p);
- ofstream& operator<<(ofstream& ist, Point& p);
- istream& operator>>(istream& ist, Point& p);
- ostream& operator<<(ostream& ist, Point& p);
- int main()
- {
- vector<Point> points;
- Point p;
- cout << "Podaj 7 par wspolrzednych:\n";
- int seven_pairs = 16;
- cin >> p;
- for (int i = 0; i < seven_pairs; ++i)
- points.push_back(p);
- }
- istream& operator>>(istream& ist, Point& p)
- {
- int x, y;
- char ch1, ch2, ch3;
- ist >> ch1 >> x >> ch2 >> y >> ch3;
- if (!ist) return ist;
- if (ch1 != '(' || ch2 != ',' || ch3 != ')') // Błąd formatu.
- {
- ist.clear(ios_base::failbit);
- return ist;
- }
- p = Point(x, y);
- return ist;
- }
- //ostream& operator<<(ostream& ist, Point& p)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement