в интернете присутствует код, если он тебе конечно нужен.
using PT4;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Text.RegularExpressions;
namespace PT4Tasks
{
public class MyTask: PT
{
public static void Solve()
{
Task("Regex");
string str = GetString(); // Примерно так выглядит путь к файлу "g:\aba\bab\1.txt";
Regex reg = new Regex(""); //Тут ошибка
string[] spl = reg.Split(str);
if (spl.Length > 2)
Put(spl[spl.Length - 1]);
else
Put(spl[0]);
}
}
}
Объяснение:
#include <iostream>
#include <iomanip>
class Point {
protected:
double* arr; //массив с координатами по осям
size_t size; //размерность вывод координат
};
class Point2D : public Point {
public:
Point2D(double x,double y) : Point(2) {
arr[0] = x; arr[1] = y;
}
void print() override {
std::cout << "x = " << std::fixed << std::setprecision(1) << arr[0] << " y = " << arr[1] << std::endl;
}
};
class Point3D : public Point {
public:
Point3D(double x, double y, double z) : Point(3) {
arr[0] = x; arr[1] = y; arr[2] = z;
}
void print() override {
std::cout << "x = " << std::fixed << std::setprecision(1) << arr[0] << " y = " << arr[1]
<< " z = " << arr[2] << std::endl;
}
};
int main(int argc, char* argv[]) {
Point* p1 = new Point2D(1.5, 4.8);
Point* p2 = new Point3D(1.0, 10.2, 3.3);
p1->print();
p2->print();
delete p1;
delete p2;
return 0;
}
Поделитесь своими знаниями, ответьте на вопрос: