Skip to content

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

Open
Palezehvat wants to merge 3 commits into
mainfrom
offsetSecondTryThirdTask
Open

Palezehvat wants to merge 3 commits into
mainfrom
offsetSecondTryThirdTask

Conversation

@Palezehvat

Copy link
Copy Markdown
Owner

No description provided.

@yurii-litvinov yurii-litvinov left a comment

Copy link
Copy Markdown

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,

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

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

fourth,
fifth,
sixth
} Stage;

Copy link
Copy Markdown

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 == '%') {

Copy link
Copy Markdown

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' };

Copy link
Copy Markdown

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;

Copy link
Copy Markdown

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

Copy link
Copy Markdown

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