int main(void) { char type; int countFigures = 0; int countRectangles = 0; int countCircles = 0; int countTriangles = 0; Rectangle rectangles[10]; Circle circles[10]; Triangle triangles[10]; float pointX; float pointY; while(scanf("%c", &type) == 1) { if (type == '*') { break; } else if (type == 'r') { readRectangle(countFigures, countRectangles, rectangles); countRectangles++; countFigures++; } else if (type == 'c') { readCircle(countFigures, countCircles, circles); countCircles++; countFigures++; } else if (type == 't') { readTriangle(countFigures, countTriangles, triangles); countTriangles++; countFigures++; } else { continue; } } int pointIndex = 1; while(scanf("%f %f\n", &pointX, &pointY) == 2) { if (pointX >= 9999 && pointY >= 9999) { break; } else { checkInFigure(rectangles, countRectangles, circles, countCircles, triangles, countTriangles, pointIndex, pointX, pointY); pointIndex++; } } return 0; }
void JsonFileReader::readGroup(Group *group, const QJsonArray &groupObj) { for (int i = 0; i < groupObj.size(); i++) { QJsonObject obj = groupObj[i].toObject(); if (obj["Type"].toString() == "Circle") { group->add(readCircle(obj)); } else if (obj["Type"].toString() == "Rectangle") { group->add(readRectangle(obj)); } else if (obj["Type"].toString() == "Line") { group->add(readLine(obj)); } else { throw std::runtime_error("Invalid visual entity!"); } } }