Skip to content

Бобрик Вячеслав Сергеевич#2

Closed
LegendaV wants to merge 1 commit intocppdevcourse:masterfrom
LegendaV:master
Closed

Бобрик Вячеслав Сергеевич#2
LegendaV wants to merge 1 commit intocppdevcourse:masterfrom
LegendaV:master

Conversation

@LegendaV
Copy link
Copy Markdown

@LegendaV LegendaV commented Oct 5, 2025

No description provided.

Copy link
Copy Markdown
Collaborator

@czertyaka czertyaka left a comment

Choose a reason for hiding this comment

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

В целом все хорошо, замечания минорные, задание принято.

Но на всякий случай: PR вливать не надо

Comment thread main.cpp
}

int main() {
srand(unsigned(time(0)));
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Приведение выполнится неявно автоматически. От приведения в стиле C особо ничего не изменится, разве что преобразование теперь перед глазами)

Comment thread main.cpp
int main() {
srand(unsigned(time(0)));

auto number = rand() % 10;
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Если переменную можно сделать константой — так лучше и поступить

Comment thread main.cpp
#define PRINT(text) std::cout << text << std::endl

int read_user_number() {
int result;
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Запись в неинициализированную переменную, строго говоря, не UB. Но вообще в реальных кодовых базах чаще стараются все же инициализировать все переменные: int result {};

@LegendaV LegendaV closed this by deleting the head repository Feb 21, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants