-
Notifications
You must be signed in to change notification settings - Fork 12
Кубышкин Владимир #10
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Conversation
|
@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; |
There was a problem hiding this comment.
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); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ещё желательно реализовать ввод выражение с переменными и для него же сделать возможность менять значения переменных и получать новый результат
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Да и ошибку искать можно сразу везде, а не по 1 методу
src/arithmetic.cpp
Outdated
| } | ||
| if (leftBrackets != rightBrackets) | ||
| { | ||
| throw myExcp("Incorrect line. Bracket placement error."); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
нужно выводить, на какой позиции появилась ошибка. и исключениям лучше присвоить имена из разряда "invalid_argument" и тд.
src/arithmetic.cpp
Outdated
|
|
||
| if (std::count(strlex.begin(), strlex.end(), '.') > 1) | ||
| { | ||
| throw myExcp("Incorrect digit form"); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
аналогично про название исключений (дальше не буду помечать)
isharamygina
left a comment
There was a problem hiding this 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) |
There was a problem hiding this comment.
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; |
There was a problem hiding this comment.
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() |
There was a problem hiding this 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
| void clear() | ||
| { | ||
| delete[] data; | ||
| data = new T[size]; |
There was a problem hiding this comment.
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); |
There was a problem hiding this comment.
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; |
There was a problem hiding this comment.
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) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Названия тестов лучше сделать такими, чтоб понимать, что проверяется
|
@ValentinV95, код готов к проверке |
|
@ValentinV95, отчет готов к проверке |
ValentinV95
left a comment
There was a problem hiding this 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, что не соответствует выражению
В отчете в руковдестве пользователя крайне мало описанное, и полностью отсутствубт скриншоты. У вас хоть и консольное приложение, но скриншоты консольного интерфейса были бы полезны
No description provided.