Skip to content

Зачёт1Задача - #22

Open
Palezehvat wants to merge 1 commit into
mainfrom
offsetFirstTaskV1
Open

Palezehvat wants to merge 1 commit into
mainfrom
offsetFirstTaskV1

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.

Я так и не понял, зачем тут стек и почему вместо него нельзя было завести массив из strlen(itoa(INT_MAX)) элементов :)

#include <string.h>

int returnFirstSymbolInNumber(int* number, int sizeNumber) {
int divide = pow(10, sizeNumber - 1);

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>
#include <string.h>

int returnFirstSymbolInNumber(int* number, int sizeNumber) {

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Неудачное название. Она не только возвращает первую цифру, но и удаляет её из числа

workWithFile(&errorCheck, fileName, numberString);
switch (errorCheck)
{
case(ok):

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
case(ok):
case ok:

emptyPointer,
anotherError,
ok,
}Error;

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

ok,
}Error;

Stack* createStack(Error* errorCheck);

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Надо комментарии, к каждой функции в заголовочном файле


int createNumberFromStack(Stack* stack, Error* errorCheck);

void addElementsFromStringToStack(Stack* stack, Error* errorCheck, char value);

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Странное название для функции, принимающей символ --- строки, о которой идёт речь в названии, вроде как нет.

return -1;
}

Stack* stack = createStack(errorCheck);

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Зачем стек, это была первая задача, на материал первых трёх пар семестра :)

int multiplay = 1;

while (walker != NULL) {
number += ((int)walker->value - 48)* multiplay;

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
number += ((int)walker->value - 48)* multiplay;
number += (walker->value - '0') * multiplay;

temp->next = stack->head;

stack->head = temp;
return;

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Это не нужно

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