#include #include #include #include using namespace std; class Point { double x,y; public: void setX(double arg) { x = arg; // implicit inline function } void setY(double arg) { y = arg; // implicit inline function } double getX() const { return x; } double getY() const { return y; } void set(double,double); void set(const string& arg); void print() const; }; void Point::set(double arg1,double arg2) { x = arg1; y = arg2; } void Point::set(const string& arg) { x = stod(arg.substr(0,6)); y = stod(arg.substr(8)); } void Point::print() const { cout << '(' << x << ',' << y << ')' << endl; } int main() { const string fn("data.txt"); Point points[24]; ifstream fin(fn); if (!fin) { cerr << "can't open " << fn << endl; exit(1); } string buffer; for (int i = 0; i < 24; i++) { getline(fin,buffer); points[i].set(buffer); } for (int i = 0; i < 24; i++) { points[i].print(); } }