Skip to content

Comments

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

Open
Palezehvat wants to merge 1 commit intomainfrom
offsetFirstTaskV1
Open

Зачёт1Задача#22
Palezehvat wants to merge 1 commit intomainfrom
offsetFirstTaskV1

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.

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

#include <string.h>

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

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) {

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):

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;

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);

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);

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);

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;

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;

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