1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26
|
int main()
{
string data="Line2D|[5, 7]=[3, 8]"
istringstream iss(data);
string dType, dVal1, dX1, dY1, dVal2, dX2, dY2;
getline(iss, dType, '|');
getline(iss, dVal1, '[');
getline(iss, dX1, ',');
getline(iss, dY1, ']');
getline(iss, dVal2, '[');
getline(iss, dX2, ',');
getline(iss, dY2, ']');
cout<<"("<<dX1<<", "<<dY1<<"), ("<<dX2<<", "<<dY2<<")";
int x1 = stoi (dX1);
int y1 = stoi (dY1);
int x2 = stoi (dX2);
int y2 = stoi (dY2);
Point2D p2d1 (x1, y1) ;
Point2D p2d2 (x2, y2);
Line2D l2d (p2d1, p2d2);
// cout<<l2d;
}
| |