Skip to content

Comments

3 Задача с зачёта#27

Open
Palezehvat wants to merge 3 commits intomainfrom
offsetSecondTryThirdTask
Open

3 Задача с зачёта#27
Palezehvat wants to merge 3 commits intomainfrom
offsetSecondTryThirdTask

Conversation

@Palezehvat
Copy link
Owner

No description provided.

Copy link

@yurii-litvinov yurii-litvinov left a comment

Choose a reason for hiding this comment

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

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

#include <stdbool.h>

typedef enum Stage {
first,

Choose a reason for hiding this comment

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

О, отступы табуляциями

fourth,
fifth,
sixth
} Stage;

Choose a reason for hiding this comment

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

Названия состояний не мнемоничны, не отражают их назначения и по сути ничем не лучше чисел. Как в анекдоте, const int one = 1;

Comment on lines +32 to +33
if (symbol >= 'A' && symbol <= 'Z' || symbol == '+' || symbol == '-'
|| symbol >= '0' && symbol <= '9' || symbol == '.' || symbol == '%') {

Choose a reason for hiding this comment

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

Сложные логические условия, тем более если планируется их переиспользовать, лучше выносить в функцию

Comment on lines +22 to +23
char buffer[1000] = { '\0' };
char result[10000] = { '\0' };

Choose a reason for hiding this comment

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

Это вообще не нужно, задачей было по строке сказать "да/нет", возвращать что-либо не просили

} else {
memset(buffer, 0, strlen(buffer));
indexBuffer = 0;
stage = first;

Choose a reason for hiding this comment

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

Не-а, тут надо было вернуть false, потому что строка уже не соответствует регэкспу


#include <stdio.h>

//Variable for error checking

Choose a reason for hiding this comment

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

Suggested change
//Variable for error checking
// Variable for error checking

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.

3 participants