Skip to content

Conversation

@wow4an3ky
Copy link

No description provided.

@wow4an3ky
Copy link
Author

@isharamygina @ZhestkovaAnastasia код готов к проверке

}
std::string str = "";
std::cout << "Enter variables from a to z" << std::endl;
std::cout << "List of operation:\n'+' - addition\n'-' - subtraction (and unary minus)\n'*' - multiplication\n'/' - division" << std::endl;

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

пропиши, пожалуйста, как можно/нужно работать с экспонентой


try
{
res = p.calculate(str1, m);

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ещё желательно реализовать ввод выражение с переменными и для него же сделать возможность менять значения переменных и получать новый результат

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Да и ошибку искать можно сразу везде, а не по 1 методу

}
if (leftBrackets != rightBrackets)
{
throw myExcp("Incorrect line. Bracket placement error.");

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

нужно выводить, на какой позиции появилась ошибка. и исключениям лучше присвоить имена из разряда "invalid_argument" и тд.


if (std::count(strlex.begin(), strlex.end(), '.') > 1)
{
throw myExcp("Incorrect digit form");

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

аналогично про название исключений (дальше не буду помечать)

Copy link

@isharamygina isharamygina left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Я несколько запуталась в названиях методов, с Настей согласна, кроме момента с исключениями, не знаю, чем тебе стдшные не зашли, но пусть так
Остался вопрос с мэйном и выдачей индекса ошибки
Попозже попробую посмотреть еще раз, когда исправишь эти моменты

include/stack.h Outdated
}
TStack(size_t n)
{
if (n < 0)

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

size_t целочисленный тип, поэтому бессмысленная проверка, отрицательные числа пройдут как положительные, просто другого типа по идее

include/stack.h Outdated
}
~TStack()
{
delete[] data;

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

лучше добавить зануление переменных и data=nullptr; - последнее иногда стреляет при игре указателями

include/stack.h Outdated
{
return index == -1;
}
bool isFull()

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Лучше сделать приватным, тк у нас неограниченный стек

include/stack.h Outdated
void clear()
{
delete[] data;
data = new T[size];

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

нет нужды всегда удалять при очищении, потому что это просто лишние действия, возможна ошибка невозможности выделения памяти, а уже все удалено, тут данные не важны, но лучше выделять до.
Опционально:
Можно не перевыделять, если стек не больше чего-то, это что-то вроде экономии памяти, если вдруг с 1000000000 элементов захотим очистить


try
{
res = p.calculate(str1, m);

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Да и ошибку искать можно сразу везде, а не по 1 методу


checkBrackets(infixString);

std::map <char, int> operations;

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Мапу запрещали для всего кроме значений переменных, да и зачем, если у тебя есть приоритеты как метод

EXPECT_EQ(str1, p.ToPostfix(str));
}

TEST(Postfix, expression_1)

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Названия тестов лучше сделать такими, чтоб понимать, что проверяется

@wow4an3ky
Copy link
Author

@ValentinV95, код готов к проверке

@wow4an3ky
Copy link
Author

@ValentinV95, отчет готов к проверке

Copy link
Owner

@ValentinV95 ValentinV95 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Лабораторная и отчет приняты
При вводе -1*10 выдвет ошибку, при этом не выдает ошибку на число 001.
При вводе 10.13e-1, почему то спрашивает значение для e, и если ввести 10, то выдает 1, что не соответствует выражению
В отчете в руковдестве пользователя крайне мало описанное, и полностью отсутствубт скриншоты. У вас хоть и консольное приложение, но скриншоты консольного интерфейса были бы полезны

@ValentinV95 ValentinV95 added the good first issue Good for newcomers label Dec 24, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

good first issue Good for newcomers

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants